#define DATESW 1
{ "date", 0 },
#define NDATESW 2
- { "nodate", 0 },
+ { "nodate", 2 },
#define TEXTSW 3
{ "text body", 0 },
#define VERSIONSW 4
#define HELPSW 5
{ "help", 0 },
#define LISTSW 6
- { "list", 1 },
+ { "list", 0 },
#define DELETESW 7
- { "delete", 2 },
+ { "delete", 0 },
#define NUMBERSW 8
- { "number", 2 },
+ { "number", 0 },
#define APPENDSW 9
- { "append", 1 },
+ { "append", 0 },
#define PRESERVESW 10
- { "preserve", 1 },
+ { "preserve", 0 },
#define NOPRESERVESW 11
- { "nopreserve", 3 },
+ { "nopreserve", 2 },
{ NULL, 0 }
};
int append = 0; /* append annotations instead of default prepend */
int number = 0; /* delete specific number of like elements if set */
-#ifdef LOCALE
setlocale(LC_ALL, "");
-#endif
invo_name = mhbasename(argv[0]);
context_read();
switch (smatch(++cp, switches)) {
case AMBIGSW:
ambigsw(cp, switches);
- done(1);
+ /* sysexits.h EX_USAGE */
+ exit(1);
case UNKWNSW:
adios(NULL, "-%s unknown", cp);
"%s [+folder] [msgs] [switches]",
invo_name);
print_help(buf, switches, 1);
- done(1);
+ exit(0);
case VERSIONSW:
print_version(invo_name);
- done(1);
+ exit(0);
case DELETESW: /* delete annotations */
mode = MODE_DEL;
else
annotate(file, comp, text, datesw, number,
append, preserve);
- done(0);
+ exit(0);
}
if (!msgs.size)
adios(NULL, "no messages in %s", folder);
/* parse all the message ranges/sequences and set SELECTED */
- for (msgnum = 0; msgnum < msgs.size; msgnum++)
- if (!m_convert(mp, msgs.msgs[msgnum]))
- done(1);
+ for (msgnum = 0; msgnum < msgs.size; msgnum++) {
+ if (!m_convert(mp, msgs.msgs[msgnum])) {
+ /* sysexits.h EX_USAGE */
+ exit(1);
+ }
+ }
/* annotate all the SELECTED messages */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
seq_save(mp);
folder_free(mp);
context_save();
- done(0);
- return 1;
+ return 0;
}
static void
fflush(stdout);
if (!fgets(buffer, sizeof buffer, stdin)) {
- done(1);
+ /* sysexits.h EX_IOERR */
+ exit(1);
}
*ap = trimcpy(buffer);
}
if (strncasecmp(field, comp, length)==0 &&
field[length] == ':') {
- for (cp = field + length + 1;
- *cp == ' ' || *cp == '\t'; cp++) {
- continue;
- }
+ cp = trim(field + length + 1);
if (number) {
printf("%d\t", count++);
}