X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/6e1d79d58e5da5ba06bc42ebebd2f6f8f2ceb52e..9322ba2854211794c27fae9468768b80b767c211:/uip/mhlsbr.c?ds=inline diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index c56acff9..f07d786d 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -306,13 +306,6 @@ static char delim4[] = "\n------------------------------\n\n"; static FILE *(*mhl_action) () = (FILE *(*) ()) 0; -/* - * Redefine a couple of functions. - * These are undefined later in the code. - */ -#define adios mhladios -#define done mhldone - /* * prototypes */ @@ -367,17 +360,21 @@ mhl (int argc, char **argv) switch (smatch (++cp, mhlswitches)) { case AMBIGSW: ambigsw (cp, mhlswitches); - done (1); + mhldone (1); + /* FALLTHRU */ case UNKWNSW: - adios (NULL, "-%s unknown\n", cp); + mhladios (NULL, "-%s unknown\n", cp); + /* FALLTHRU */ case HELPSW: snprintf (buf, sizeof(buf), "%s [switches] [files ...]", invo_name); print_help (buf, mhlswitches, 1); - done (0); + mhldone (0); + /* FALLTHRU */ case VERSIONSW: print_version(invo_name); - done (0); + mhldone (0); + /* FALLTHRU */ case BELLSW: bellflg = 1; @@ -395,23 +392,23 @@ mhl (int argc, char **argv) case FOLDSW: if (!(folder = *argp++) || *folder == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); continue; case FORMSW: if (!(form = *argp++) || *form == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); continue; case SLEEPSW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); else sleepsw = atoi (cp);/* ZERO ok! */ continue; case PROGSW: if (!(moreproc = *argp++) || *moreproc == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); continue; case NPROGSW: nomore++; @@ -419,7 +416,7 @@ mhl (int argc, char **argv) case FMTPROCSW: if (!(formatproc = *argp++) || *formatproc == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); continue; case NFMTPROCSW: formatproc = NULL; @@ -427,36 +424,37 @@ mhl (int argc, char **argv) case LENSW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); else if ((length = atoi (cp)) < 1) - adios (NULL, "bad argument %s %s", argp[-2], cp); + mhladios (NULL, "bad argument %s %s", argp[-2], cp); continue; case WIDTHSW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); else if ((width = atoi (cp)) < 1) - adios (NULL, "bad argument %s %s", argp[-2], cp); + mhladios (NULL, "bad argument %s %s", argp[-2], cp); continue; case DGSTSW: if (!(digest = *argp++) || *digest == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); continue; case ISSUESW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); else if ((issue = atoi (cp)) < 1) - adios (NULL, "bad argument %s %s", argp[-2], cp); + mhladios (NULL, "bad argument %s %s", argp[-2], cp); continue; case VOLUMSW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + mhladios (NULL, "missing argument to %s", argp[-2]); else if ((volume = atoi (cp)) < 1) - adios (NULL, "bad argument %s %s", argp[-2], cp); + mhladios (NULL, "bad argument %s %s", argp[-2], cp); continue; case FORW2SW: - forwall++; /* fall */ + forwall++; + /* FALLTHRU */ case FORW1SW: forwflg++; clearflg = -1;/* XXX */ @@ -530,7 +528,7 @@ mhl (int argc, char **argv) fflush(stdout); if(ferror(stdout)){ - adios("output", "error writing"); + mhladios("output", "error writing"); } if (clearflg > 0 && ontty == NOTTY) @@ -566,7 +564,7 @@ mhl_format (char *file, int length, int width) } if ((fp = fopen (etcpath (file), "r")) == NULL) - adios (file, "unable to open format file"); + mhladios (file, "unable to open format file"); if (fstat (fileno (fp), &st) != NOTOK) { mtime = st.st_mtime; @@ -592,7 +590,7 @@ mhl_format (char *file, int length, int width) if (*bp == ';') continue; - TrimSuffixC(bp, '\n'); + trim_suffix_c(bp, '\n'); if (*bp == ':') { (void) add_queue (&fmthd, &fmttl, NULL, bp + 1, CLEARTEXT); @@ -629,7 +627,7 @@ mhl_format (char *file, int length, int width) parptr = bp; while (*parptr) { if (evalvar (&global)) - adios (NULL, "format file syntax error: %s", bp); + mhladios (NULL, "format file syntax error: %s", bp); if (*parptr) parptr++; } @@ -640,7 +638,7 @@ mhl_format (char *file, int length, int width) while (*parptr == ':' || *parptr == ',') { parptr++; if (evalvar (c1)) - adios (NULL, "format file syntax error: %s", bp); + mhladios (NULL, "format file syntax error: %s", bp); } if (!c1->c_nfs && global.c_nfs) { if (c1->c_flags & DATEFMT) { @@ -660,7 +658,7 @@ mhl_format (char *file, int length, int width) continue; default: - adios (NULL, "format file syntax error: %s", bp); + mhladios (NULL, "format file syntax error: %s", bp); } } fclose (fp); @@ -907,7 +905,7 @@ process (char *folder, char *fname, int ofilen, int ofilec) cp = folder ? concat (folder, ":", fname2, NULL) : mh_xstrdup(fname2); if (ontty != PITTY) SIGNAL (SIGINT, intrser); - mhlfile (fp, cp, ofilen, ofilec); /* FALL THROUGH! */ + mhlfile (fp, cp, ofilen, ofilec); free (cp); for (ap = arglist_head; ap; ap = ap->a_next) { @@ -916,7 +914,8 @@ process (char *folder, char *fname, int ofilen, int ofilec) } if (arglist_head) - fmt_free(NULL, 1); + fmt_free(NULL, 1); + /* FALLTHRU */ default: if (ontty != PITTY) @@ -1107,7 +1106,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec) return; default: - adios (NULL, "getfld() returned %d", state); + mhladios (NULL, "getfld() returned %d", state); } } } @@ -1310,7 +1309,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) if ((ovtxt = c1->c_ovtxt ? c1->c_ovtxt : global.c_ovtxt) == NULL) ovtxt = ""; if (wid < ovoff + strlen (ovtxt) + 5) - adios (NULL, "component: %s width(%d) too small for overflow(%d)", + mhladios (NULL, "component: %s width(%d) too small for overflow(%d)", c1->c_name, wid, ovoff + strlen (ovtxt) + 5); onelp = NULL; @@ -1337,7 +1336,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) if (!(c1->c_flags & HDROUTPUT) && !(c1->c_flags & NOCOMPONENT)) { if (c1->c_flags & UPPERCASE) /* uppercase component also */ - ToUpper(text); + to_upper(text); putstr(text, c1->c_flags); if (flag != BODYCOMP) { putstr (": ", c1->c_flags); @@ -1357,7 +1356,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) && !(c2->c_flags & HDROUTPUT) && !(c2->c_flags & NOCOMPONENT)) { if (c1->c_flags & UPPERCASE) - ToUpper(c2->c_name); + to_upper(c2->c_name); putstr (c2->c_name, c1->c_flags); putstr (": ", c1->c_flags); if (!(c1->c_flags & SPLIT)) @@ -1369,7 +1368,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag) putstr (" ", c1->c_flags); } if (c1->c_flags & UPPERCASE) - ToUpper(c2->c_text); + to_upper(c2->c_text); count = 0; if (cchdr) { @@ -1624,7 +1623,7 @@ pipeser (int i) { NMH_UNUSED (i); - done (NOTOK); + mhldone (NOTOK); } @@ -1635,13 +1634,10 @@ quitser (int i) putchar ('\n'); fflush (stdout); - done (NOTOK); + mhldone (NOTOK); } -#undef adios -#undef done - static void mhladios (char *what, char *fmt, ...) {