]> diplodocus.org Git - nmh/blobdiff - uip/mhlsbr.c
sizeof char is always 1, so don't bother to divide by it.
[nmh] / uip / mhlsbr.c
index 1cc472b5de1e8409658554b3211f9833d52d49a1..a4402c567301d6eab9c44e7ec3f2b4efd1ad9b6c 100644 (file)
@@ -11,6 +11,7 @@
 #include <h/fmt_scan.h>
 #include <h/tws.h>
 #include <h/utils.h>
 #include <h/fmt_scan.h>
 #include <h/tws.h>
 #include <h/utils.h>
+#include "../sbr/m_popen.h"
 #include <setjmp.h>
 #include <sys/types.h>
 
 #include <setjmp.h>
 #include <sys/types.h>
 
@@ -302,7 +303,7 @@ static char delim3[] =              /* from forw.c */
     "\n----------------------------------------------------------------------\n\n";
 static char delim4[] = "\n------------------------------\n\n";
 
     "\n----------------------------------------------------------------------\n\n";
 static char delim4[] = "\n------------------------------\n\n";
 
-static FILE *(*mhl_action) () = (FILE *(*) ()) 0;
+static FILE *(*mhl_action)(char *);
 
 /*
  * prototypes
 
 /*
  * prototypes
@@ -521,7 +522,7 @@ mhl (int argc, char **argv)
        }
        else
            printf ("\n------- End of Forwarded Message%s\n",
        }
        else
            printf ("\n------- End of Forwarded Message%s\n",
-                   vecp > 1 ? "s" : "");
+                   PLURALS(vecp));
     }
 
     fflush(stdout);
     }
 
     fflush(stdout);
@@ -848,15 +849,14 @@ parse (void)
 
     for (cp = result; *parptr && (cp - result < NAMESZ); parptr++) {
        c = *parptr;
 
     for (cp = result; *parptr && (cp - result < NAMESZ); parptr++) {
        c = *parptr;
-       if (isalnum (c)
-               || c == '.'
-               || c == '-'
-               || c == '_'
-               || c =='['
-               || c == ']')
-           *cp++ = c;
-       else
+       if (!isalnum (c)
+               && c != '.'
+               && c != '-'
+               && c != '_'
+               && c !='['
+               && c != ']')
            break;
            break;
+        *cp++ = c;
     }
     *cp = '\0';
 
     }
     *cp = '\0';
 
@@ -936,7 +936,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
 {
     int state, bucket;
     struct mcomp *c1, *c2, *c3;
 {
     int state, bucket;
     struct mcomp *c1, *c2, *c3;
-    char **ip, name[NAMESZ], buf[BUFSIZ];
+    char **ip, name[NAMESZ], buf[NMH_BUFSIZ];
     m_getfld_state_t gstate = 0;
 
     compile_filterargs();
     m_getfld_state_t gstate = 0;
 
     compile_filterargs();
@@ -947,7 +947,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
        else {
            printf ("\n-------");
            if (ofilen == 1)
        else {
            printf ("\n-------");
            if (ofilen == 1)
-               printf (" Forwarded Message%s", ofilec > 1 ? "s" : "");
+               printf (" Forwarded Message%s", PLURALS(ofilec));
            else
                printf (" Message %d", ofilen);
            printf ("\n\n");
            else
                printf (" Message %d", ofilen);
            printf ("\n\n");
@@ -1020,13 +1020,13 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                    continue;
 
                for (c2 = fmthd; c2; c2 = c2->c_next)
                    continue;
 
                for (c2 = fmthd; c2; c2 = c2->c_next)
-                   if (!strcasecmp (c2->c_name ? c2->c_name : "", name))
+                   if (!strcasecmp (FENDNULL(c2->c_name), name))
                        break;
                c1 = NULL;
                if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
                    for (c1 = msghd; c1; c1 = c1->c_next)
                        break;
                c1 = NULL;
                if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
                    for (c1 = msghd; c1; c1 = c1->c_next)
-                       if (!strcasecmp (c1->c_name ? c1->c_name : "",
-                                        c3->c_name ? c3->c_name : "")) {
+                       if (!strcasecmp (FENDNULL(c1->c_name),
+                                        FENDNULL(c3->c_name))) {
                            c1->c_text =
                                mcomp_add (c1->c_flags, buf, c1->c_text);
                            break;
                            c1->c_text =
                                mcomp_add (c1->c_flags, buf, c1->c_text);
                            break;
@@ -1086,8 +1086,8 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                        continue;
                    }
                    for (c2 = msghd; c2; c2 = c2->c_next)
                        continue;
                    }
                    for (c2 = msghd; c2; c2 = c2->c_next)
-                       if (!strcasecmp (c2->c_name ? c2->c_name : "",
-                                        c1->c_name ? c1->c_name : "")) {
+                       if (!strcasecmp (FENDNULL(c2->c_name),
+                                        FENDNULL(c1->c_name))) {
                            putcomp (c1, c2, ONECOMP);
                            if (!(c1->c_flags & SPLIT))
                                break;
                            putcomp (c1, c2, ONECOMP);
                            if (!(c1->c_flags & SPLIT))
                                break;
@@ -1431,11 +1431,10 @@ oneline (char *stuff, unsigned long flags)
                    *onelp++ = 0;
                    break;
                }
                    *onelp++ = 0;
                    break;
                }
-               else
-                   if (!spc) {
-                       *cp++ = ' ';
-                       spc++;
-                   }
+                if (!spc) {
+                    *cp++ = ' ';
+                    spc++;
+                }
            }
            else {
                *cp++ = *onelp;
            }
            else {
                *cp++ = *onelp;
@@ -1592,7 +1591,7 @@ putch (char ch, unsigned long flags)
        putch ('\n', flags);
        if (ovoff > 0)
            lm = ovoff;
        putch ('\n', flags);
        if (ovoff > 0)
            lm = ovoff;
-       putstr (ovtxt ? ovtxt : "", flags);
+       putstr (FENDNULL(ovtxt), flags);
        putch (ch, flags);
        return;
     }
        putch (ch, flags);
        return;
     }