Skip to content

Commit 64ea770

Browse files
committed
catch misattempts in acronym spelling
1 parent aaaa994 commit 64ea770

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sortdb.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <wchar.h>
3030
#include <wctype.h>
3131

32-
__RCSID("$MirOS: wtf/sortdb.c,v 1.27 2023/12/04 22:39:21 tg Exp $");
32+
__RCSID("$MirOS: wtf/sortdb.c,v 1.28 2023/12/04 22:47:24 tg Exp $");
3333

3434
#define MAXCASECONV 512
3535
struct cconv {
@@ -324,8 +324,14 @@ main(int argc, char *argv[])
324324
goto end_of_line;
325325
if (iswspace(cw))
326326
goto parse_line;
327-
if (!atp && !asp && cw == L'{' && *cwp != L'}' &&
328-
(twp = wcschr(cwp, /*{*/ L'}'))) {
327+
if (!atp && !asp && cw == L'{' && *cwp != L'}') {
328+
twp = wcschr(cwp, /*{*/ L'}');
329+
if (!twp) {
330+
fprintf(stderr, "W: #%zu unterminated asp <%ls>\n",
331+
nlines + 1, cwp - 1);
332+
rv = 3;
333+
goto not_asp;
334+
}
329335
/* acronym casespelling */
330336
asp = cwp;
331337
asplen = twp - asp;
@@ -371,6 +377,8 @@ main(int argc, char *argv[])
371377
rv = 3;
372378
}
373379
goto parse_line;
380+
not_asp:
381+
;
374382
}
375383
if (cw == L'[' && wcschr(cwp, L']')) {
376384
/* leading tag */

0 commit comments

Comments
 (0)