X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/5dd6771b28c257af405d7248639ed0e3bcdce38b..bcb443a54dc3e08c2aa51fa1dd414cf2023fc037:/uip/mark.c?ds=inline diff --git a/uip/mark.c b/uip/mark.c index dd09b488..f99832a2 100644 --- a/uip/mark.c +++ b/uip/mark.c @@ -12,31 +12,26 @@ #include #include -static struct swit switches[] = { -#define ADDSW 0 - { "add", 0 }, -#define DELSW 1 - { "delete", 0 }, -#define LSTSW 2 - { "list", 0 }, -#define SEQSW 3 - { "sequence name", 0 }, -#define PUBLSW 4 - { "public", 0 }, -#define NPUBLSW 5 - { "nopublic", 0 }, -#define ZEROSW 6 - { "zero", 0 }, -#define NZEROSW 7 - { "nozero", 0 }, -#define VERSIONSW 8 - { "version", 0 }, -#define HELPSW 9 - { "help", 0 }, -#define DEBUGSW 10 - { "debug", -5 }, - { NULL, 0 } -}; +#define MARK_SWITCHES \ + X("add", 0, ADDSW) \ + X("delete", 0, DELSW) \ + X("list", 0, LSTSW) \ + X("sequence name", 0, SEQSW) \ + X("public", 0, PUBLSW) \ + X("nopublic", 0, NPUBLSW) \ + X("zero", 0, ZEROSW) \ + X("nozero", 0, NZEROSW) \ + X("version", 0, VERSIONSW) \ + X("help", 0, HELPSW) \ + X("debug", -5, DEBUGSW) \ + +#define X(sw, minchars, id) id, +DEFINE_SWITCH_ENUM(MARK); +#undef X + +#define X(sw, minchars, id) { sw, minchars, id }, +DEFINE_SWITCH_ARRAY(MARK, switches); +#undef X /* * static prototypes @@ -49,8 +44,8 @@ int main (int argc, char **argv) { int addsw = 0, deletesw = 0, debugsw = 0; - int listsw = 0, publicsw = -1, zerosw = 0; - int seqp = 0, msgnum; + int listsw = 0, publicsw = -1, zerosw = 0, msgnum; + unsigned int seqp = 0; char *cp, *maildir, *folder = NULL, buf[BUFSIZ]; char **argp, **arguments; char *seqs[NUMATTRS + 1]; @@ -84,10 +79,10 @@ main (int argc, char **argv) snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case ADDSW: addsw++;