]> diplodocus.org Git - nmh/blobdiff - sbr/print_sw.c
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / sbr / print_sw.c
index 426724b4415697b2972438b0dc4bd59579928d07..cc16626b2ca03477f3e12ff48d9272dded09d206 100644 (file)
@@ -2,8 +2,6 @@
 /*
  * print_sw.c -- print switches
  *
- * $Id$
- *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  * complete copyright information.
 
 
 void
-print_sw (char *substr, struct swit *swp, char *prefix)
+print_sw (const char *substr, const struct swit *swp, char *prefix, FILE *fp)
 {
     int len, optno;
-    register int i;
-    register char *cp, *cp1, *sp;
+    int i;
+    char *cp, *cp1, *sp;
     char buf[128];
 
     len = strlen(substr);
@@ -45,10 +43,11 @@ print_sw (char *substr, struct swit *swp, char *prefix)
                    *cp++ = *cp1++;
                *cp++ = ')';
                while ((*cp++ = *cp1++));
-               printf ("  %s%s\n", prefix, buf);
+               fprintf (fp, "  %s%s\n", prefix, buf);
            } else {
                if (!swp->minchars)
-                   printf(optno ? "  %s[no]%s\n" : "  %s%s\n", prefix, swp->sw);
+                   fprintf(fp, optno ? "  %s[no]%s\n" : "  %s%s\n",
+                            prefix, swp->sw);
            }
            if (optno)
                swp++;  /* skip -noswitch */