]> diplodocus.org Git - nmh/blobdiff - uip/mhlsbr.c
Migrated show_content_aux2() to argsplit().
[nmh] / uip / mhlsbr.c
index 69e3f1f664de80e2fa747317c961452061362055..3ebfa69eee77774db6d555efe59cfdaa380eecec 100644 (file)
@@ -14,8 +14,6 @@
 #include <h/tws.h>
 #include <h/utils.h>
 #include <setjmp.h>
-#include <signal.h>
-#include <errno.h>
 #include <sys/types.h>
 
 /*
@@ -351,11 +349,9 @@ mhl (int argc, char **argv)
     char buf[BUFSIZ], *files[MAXARGS];
     char **argp, **arguments;
 
+    /* Need this if called from main() of show(1). */
     invo_name = r1bindex (argv[0], '/');
 
-    /* read user profile/context */
-    context_read();
-
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
 
@@ -480,7 +476,7 @@ mhl (int argc, char **argv)
        folder = getenv ("mhfolder");
 
     if (isatty (fileno (stdout))) {
-       if (!nomore && !sc_hardcopy() && moreproc && *moreproc != '\0') {
+       if (!nomore && moreproc && *moreproc != '\0') {
            if (mhl_action) {
                SIGNAL (SIGINT, SIG_IGN);
                SIGNAL2 (SIGQUIT, quitser);
@@ -533,7 +529,7 @@ mhl (int argc, char **argv)
     }
     
     if (clearflg > 0 && ontty == NOTTY)
-       clear_screen ();
+       nmh_clear_screen ();
 
     if (ontty == PITTY)
        m_pclose ();
@@ -879,6 +875,8 @@ process (char *folder, char *fname, int ofilen, int ofilec)
     struct mcomp *c1;
     struct stat st;
     struct arglist *ap;
+    /* volatile to prevent "might be clobbered" warning from gcc: */
+    char *volatile fname2 = fname ? fname : "(stdin)";
 
     switch (setjmp (env)) {
        case OK: 
@@ -890,7 +888,6 @@ process (char *folder, char *fname, int ofilen, int ofilec)
                    return;
                }
            } else {
-               fname = "(stdin)";
                fp = stdin;
            }
            if (fstat(fileno(fp), &st) == 0) {
@@ -898,7 +895,7 @@ process (char *folder, char *fname, int ofilen, int ofilec)
            } else {
                filesize = 0;
            }
-           cp = folder ? concat (folder, ":", fname, NULL) : getcpy (fname);
+           cp = folder ? concat (folder, ":", fname2, NULL) : getcpy (fname2);
            if (ontty != PITTY)
                SIGNAL (SIGINT, intrser);
            mhlfile (fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
@@ -957,7 +954,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                if (ofilec > 1) {
                    if (ofilen > 1) {
                        if ((global.c_flags & CLEARSCR))
-                           clear_screen ();
+                           nmh_clear_screen ();
                        else
                            printf ("\n\n\n");
                    }
@@ -979,7 +976,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                }
                if (strchr(buf, '\n')) {
                    if ((global.c_flags & CLEARSCR))
-                       clear_screen ();
+                       nmh_clear_screen ();
                }
                else
                    printf ("\n");
@@ -990,7 +987,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                    if (ofilen > 1) {
                        printf ("\n\n\n");
                        if (clearflg > 0)
-                           clear_screen ();
+                           nmh_clear_screen ();
                    }
                    printf (">>> %s\n\n", mname);
                }
@@ -1181,7 +1178,7 @@ mcomp_format (struct mcomp *c1, struct mcomp *c2)
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
 
-       if ((mp = getm (cp, NULL, 0, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
        } else {
@@ -1486,7 +1483,7 @@ putch (char ch, long flags)
            read (fileno (stdout), buf, sizeof(buf));
            if (strchr(buf, '\n')) {
                if (global.c_flags & CLEARSCR)
-                   clear_screen ();
+                   nmh_clear_screen ();
                row = 0;
            } else {
                putchar ('\n');
@@ -1853,7 +1850,6 @@ filterbody (struct mcomp *c1, char *buf, int bufsz, int state, FILE *fp,
         * buffers that we have duplicated from the parent.
         */
        _exit(0);
-       break;
     case -1:
        adios(NULL, "Unable to fork for filter writer process");
        break;