Use sysexits.h for better exit-codes
[mmh] / sbr / fmt_scan.c
index ec086a1..a8e773a 100644 (file)
@@ -14,6 +14,8 @@
 #include <h/fmt_scan.h>
 #include <h/tws.h>
 #include <h/fmt_compile.h>
+#include <ctype.h>
+#include <sysexits.h>
 
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
@@ -322,7 +324,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat)
                        cptrimmed(&cp, str, fmt->f_width, fmt->f_fill, ep - cp);
                        break;
                case FT_STRFW:
-                       adios(NULL, "internal error (FT_STRFW)");
+                       adios(EX_SOFTWARE, NULL, "internal error (FT_STRFW)");
 
                case FT_NUM:
                        n = snprintf(cp, ep - cp + 1, "%d", value);
@@ -677,7 +679,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat)
                                                } else
                                                        str = mn->m_text;
                                                break;
-                                 }
+                                       }
                                }
                        }
                        break;
@@ -774,16 +776,17 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat)
                        indent = strlen(sp);
                        wid -= indent;
                        if (wid <= 0) {
-                               adios(NULL, "putaddr -- num register (%d) "
+                               adios(EX_SOFTWARE, NULL, "putaddr -- num register (%d) "
                                                "must be greater than label "
                                                "width (%d)", value, indent);
                        }
                        while( (c = *sp++) && cp < ep)
                                *cp++ = c;
                        while (len > wid) {
-                               /* try to break at a comma; failing that,
-                                * break at a space.
-                                */
+                               /*
+                               ** try to break at a comma; failing that,
+                               ** break at a space.
+                               */
                                lastb = 0; sp = lp + wid;
                                while (sp > lp && (c = *--sp) != ',') {
                                        if (! lastb && isspace(c))