]> diplodocus.org Git - nmh/blobdiff - uip/fmtdump.c
Removed a local variable from m_Eom().
[nmh] / uip / fmtdump.c
index a45ea801898198bbc1e0a4297627046ac1ba154f..6a6ef7cbdd1851879e7c2e43ca850fc894daedbb 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * fmtdump.c -- compile format file and dump out instructions
+/* fmtdump.c -- compile format file and dump out instructions
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -11,6 +9,7 @@
 #include <h/fmt_scan.h>
 #include <h/fmt_compile.h>
 #include <h/scansbr.h>
+#include <h/utils.h>
 
 #define FMTDUMP_SWITCHES \
     X("form formatfile", 0, FORMSW) \
@@ -51,7 +50,7 @@ main (int argc, char **argv)
     char buf[BUFSIZ], *nfs, **argp, **arguments;
     struct format *fmt;
 
-    if (nmh_init(argv[0], 1)) { return 1; }
+    if (nmh_init(argv[0], 2)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -110,7 +109,7 @@ static void
 fmt_dump (struct format *fmth)
 {
        int i;
-       register struct format *fmt, *addr;
+       struct format *fmt, *addr;
 
        /* Assign labels */
        for (fmt = fmth; fmt; ++fmt) {
@@ -142,7 +141,7 @@ fmt_dump (struct format *fmth)
 static void
 dumpone(struct format *fmt)
 {
-       register int i;
+       int i;
 
        if ((i = findlabel(fmt)) >= 0)
                printf("L%d:", i);
@@ -266,6 +265,7 @@ dumpone(struct format *fmt)
        case FT_IF_MATCH:
        case FT_IF_AMATCH:
                printf(" continue else goto");
+               /* FALLTHRU */
        case FT_GOTO:
                i = findlabel(fmt + fmt->f_skip);
                printf(" L%d", i);
@@ -322,7 +322,7 @@ dumpone(struct format *fmt)
 static int
 findlabel(struct format *addr)
 {
-       register int i;
+       int i;
 
        for (i = 0; i < lused; ++i)
                if (addr == lvec[i])
@@ -420,9 +420,7 @@ f_typestr(int t)
        case FT_GETMYMBOX: return("GETMYMBOX");
        case FT_GETMYADDR: return("GETMYADDR");
        case FT_SAVESTR: return("SAVESTR");
-#ifdef FT_PAUSE
        case FT_PAUSE: return ("PAUSE");
-#endif
        case FT_DONE: return("DONE");
        case FT_NOP: return("NOP");
        case FT_GOTO: return("GOTO");
@@ -454,7 +452,7 @@ f_typestr(int t)
 static char *
 c_typestr(int t)
 {
-       register int i;
+       int i;
        static char buf[64];
 
        buf[0] = '\0';
@@ -471,7 +469,7 @@ c_typestr(int t)
 static char *
 c_flagsstr(int t)
 {
-       register int i;
+       int i;
        static char buf[64];
 
        buf[0] = '\0';
@@ -492,10 +490,10 @@ static void
 litputs(char *s)
 {
        if (s) {
-               putc('"', stdout);
+               putchar('"');
                while (*s)
                        litputc(*s++);
-               putc('"', stdout);
+               putchar('"');
        } else
                fputs("<nil>", stdout);
 }
@@ -504,30 +502,30 @@ static void
 litputc(char c)
 {
        if (c & ~ 0177) {
-               putc('M', stdout);
-               putc('-', stdout);
+               putchar('M');
+               putchar('-');
                c &= 0177;
        }
        if (c < 0x20 || c == 0177) {
                if (c == '\b') {
-                       putc('\\', stdout);
-                       putc('b', stdout);
+                       putchar('\\');
+                       putchar('b');
                } else if (c == '\f') {
-                       putc('\\', stdout);
-                       putc('f', stdout);
+                       putchar('\\');
+                       putchar('f');
                } else if (c == '\n') {
-                       putc('\\', stdout);
-                       putc('n', stdout);
+                       putchar('\\');
+                       putchar('n');
                } else if (c == '\r') {
-                       putc('\\', stdout);
-                       putc('r', stdout);
+                       putchar('\\');
+                       putchar('r');
                } else if (c == '\t') {
-                       putc('\\', stdout);
-                       putc('t', stdout);
+                       putchar('\\');
+                       putchar('t');
                } else {
-                       putc('^', stdout);
-                       putc(c ^ 0x40, stdout); /* DEL to ?, others to alpha */
+                       putchar('^');
+                       putchar(c ^ 0x40);      /* DEL to ?, others to alpha */
                }
        } else
-               putc(c, stdout);
+               putchar(c);
 }