Use trim() to strip whitespace from the end of header fields
[mmh] / uip / anno.c
index 3958eb1..e874238 100644 (file)
@@ -26,7 +26,7 @@ static struct swit switches[] = {
 #define DATESW 1
        { "date", 0 },
 #define NDATESW 2
-       { "nodate", 0 },
+       { "nodate", 2 },
 #define TEXTSW 3
        { "text body", 0 },
 #define VERSIONSW 4
@@ -44,7 +44,7 @@ static struct swit switches[] = {
 #define PRESERVESW 10
        { "preserve", 0 },
 #define NOPRESERVESW 11
-       { "nopreserve", 0 },
+       { "nopreserve", 2 },
        { NULL, 0 }
 };
 
@@ -74,9 +74,7 @@ main(int argc, char **argv)
        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();
 
@@ -330,10 +328,7 @@ annolist(char *file, unsigned char *comp, int number)
 
                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++);
                        }