]> diplodocus.org Git - nmh/blobdiff - uip/fmtdump.c
Replace some ints that are only ever 0 or 1 with bool.
[nmh] / uip / fmtdump.c
index 90e87e1574dda76ade30e9fb2614530fcc66ba7c..7293e134f1c41dc97cd7b92db4e514a09cba54dc 100644 (file)
@@ -9,6 +9,7 @@
 #include <h/fmt_scan.h>
 #include <h/fmt_compile.h>
 #include <h/scansbr.h>
 #include <h/fmt_scan.h>
 #include <h/fmt_compile.h>
 #include <h/scansbr.h>
+#include "h/done.h"
 #include <h/utils.h>
 
 #define FMTDUMP_SWITCHES \
 #include <h/utils.h>
 
 #define FMTDUMP_SWITCHES \
@@ -50,7 +51,7 @@ main (int argc, char **argv)
     char buf[BUFSIZ], *nfs, **argp, **arguments;
     struct format *fmt;
 
     char buf[BUFSIZ], *nfs, **argp, **arguments;
     struct format *fmt;
 
-    if (nmh_init(argv[0], 2)) { return 1; }
+    if (nmh_init(argv[0], true, false)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -62,7 +63,7 @@ main (int argc, char **argv)
                    ambigsw (cp, switches);
                    done (1);
                case UNKWNSW: 
                    ambigsw (cp, switches);
                    done (1);
                case UNKWNSW: 
-                   adios (NULL, "-%s unknown", cp);
+                   die("-%s unknown", cp);
 
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [switches]", invo_name);
 
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [switches]", invo_name);
@@ -74,19 +75,19 @@ main (int argc, char **argv)
 
                case FORMSW: 
                    if (!(form = *argp++) || *form == '-')
 
                case FORMSW: 
                    if (!(form = *argp++) || *form == '-')
-                       adios (NULL, "missing argument to %s", argp[-2]);
+                       die("missing argument to %s", argp[-2]);
                    format = NULL;
                    continue;
                case FMTSW: 
                    if (!(format = *argp++) || *format == '-')
                    format = NULL;
                    continue;
                case FMTSW: 
                    if (!(format = *argp++) || *format == '-')
-                       adios (NULL, "missing argument to %s", argp[-2]);
+                       die("missing argument to %s", argp[-2]);
                    form = NULL;
                    continue;
 
            }
        }
        if (form)
                    form = NULL;
                    continue;
 
            }
        }
        if (form)
-           adios (NULL, "only one form at a time!");
+           die("only one form at a time!");
         form = cp;
     }
 
         form = cp;
     }
 
@@ -154,7 +155,7 @@ dumpone(struct format *fmt)
        case FT_LS_COMP:
        case FT_LV_COMPFLAG:
        case FT_LV_COMP:
        case FT_LS_COMP:
        case FT_LV_COMPFLAG:
        case FT_LV_COMP:
-               printf(", comp ");
+               fputs(", comp ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -186,7 +187,7 @@ dumpone(struct format *fmt)
        case FT_LOCALDATE:
        case FT_GMTDATE:
        case FT_PARSEDATE:
        case FT_LOCALDATE:
        case FT_GMTDATE:
        case FT_PARSEDATE:
-               printf(", c_name ");
+               fputs(", c_name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -210,7 +211,7 @@ dumpone(struct format *fmt)
        case FT_MYMBOX:
        case FT_GETMYMBOX:
        case FT_GETMYADDR:
        case FT_MYMBOX:
        case FT_GETMYMBOX:
        case FT_GETMYADDR:
-               printf(", c_name ");
+               fputs(", c_name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -221,7 +222,7 @@ dumpone(struct format *fmt)
        case FT_COMPF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
        case FT_COMPF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
-               printf("' name ");
+               fputs("' name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -244,7 +245,7 @@ dumpone(struct format *fmt)
        case FT_LITF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
        case FT_LITF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
-               printf("' ");
+               fputs("' ", stdout);
                litputs(fmt->f_text);
                break;
 
                litputs(fmt->f_text);
                break;
 
@@ -260,7 +261,7 @@ dumpone(struct format *fmt)
        case FT_IF_S_NULL:
        case FT_IF_MATCH:
        case FT_IF_AMATCH:
        case FT_IF_S_NULL:
        case FT_IF_MATCH:
        case FT_IF_AMATCH:
-               printf(" continue else goto");
+               fputs(" continue else goto", stdout);
                /* FALLTHRU */
        case FT_GOTO:
                i = findlabel(fmt + fmt->f_skip);
                /* FALLTHRU */
        case FT_GOTO:
                i = findlabel(fmt + fmt->f_skip);
@@ -287,17 +288,17 @@ dumpone(struct format *fmt)
                break;
 
        case FT_LS_LIT:
                break;
 
        case FT_LS_LIT:
-               printf(" str ");
+               fputs(" str ", stdout);
                litputs(fmt->f_text);
                break;
 
        case FT_LS_GETENV:
                litputs(fmt->f_text);
                break;
 
        case FT_LS_GETENV:
-               printf(" getenv ");
+               fputs(" getenv ", stdout);
                litputs(fmt->f_text);
                break;
 
        case FT_LS_DECODECOMP:
                litputs(fmt->f_text);
                break;
 
        case FT_LS_DECODECOMP:
-               printf(", comp ");
+               fputs(", comp ", stdout);
                litputs(fmt->f_comp->c_name);
                break;
 
                litputs(fmt->f_comp->c_name);
                break;