summaryrefslogtreecommitdiff
path: root/usr.bin/gencat
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2019-07-25 13:53:58 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2019-07-25 13:53:58 +0000
commit85a7f777b5a104321d8d6296b08656cf966309fb (patch)
treede904275b41db0b39f9a2e8f0ce411bb27b05f8a /usr.bin/gencat
parentaffa1b528f4b8a1aca4eac73e8b3ad66cc57952f (diff)
According to our manual page and to POSIX, $set defaults to NL_SETD.
Bug reported by Marcel Logen <333200007110-0201 at ybtra dot de>. While here, remove the misleading initialization of msgid which is not a state variable. OK millert@ deraadt@
Diffstat (limited to 'usr.bin/gencat')
-rw-r--r--usr.bin/gencat/gencat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/gencat/gencat.c b/usr.bin/gencat/gencat.c
index 345bafa52d3..9775de75aaf 100644
--- a/usr.bin/gencat/gencat.c
+++ b/usr.bin/gencat/gencat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gencat.c,v 1.19 2019/06/28 13:35:01 deraadt Exp $ */
+/* $OpenBSD: gencat.c,v 1.20 2019/07/25 13:53:57 schwarze Exp $ */
/* $NetBSD: gencat.c,v 1.9 1998/10/09 17:00:56 itohy Exp $ */
/*-
@@ -405,11 +405,12 @@ void
MCParse(int fd)
{
char *cptr, *str;
- int setid, msgid = 0;
+ int setid, msgid;
char quote = 0;
/* XXX: init sethead? */
+ setid = 0;
while ((cptr = get_line(fd))) {
if (*cptr == '$') {
++cptr;
@@ -418,7 +419,6 @@ MCParse(int fd)
cptr = wskip(cptr);
setid = atoi(cptr);
MCAddSet(setid);
- msgid = 0;
} else if (strncmp(cptr, "delset", 6) == 0) {
cptr += 6;
cptr = wskip(cptr);
@@ -463,6 +463,10 @@ MCParse(int fd)
warning(cptr, "neither blank line nor start of a message id");
continue;
}
+ if (setid == 0) {
+ setid = NL_SETD;
+ MCAddSet(setid);
+ }
/*
* If we have a message ID, but no message,
* then this means "delete this message id