moreproc will always be set in config/config.c, thus eliminated the ISTTY case.
[mmh] / uip / mhl.c
index d3b7429..98e58d0 100644 (file)
--- a/uip/mhl.c
+++ b/uip/mhl.c
@@ -55,29 +55,27 @@ static struct swit mhlswitches[] = {
        { "form formfile", 0 },
 #define PROGSW  6
        { "moreproc program", 0 },
-#define NPROGSW  7
-       { "nomoreproc", 0 },
-#define LENSW  8
+#define LENSW  7
        { "length lines", 0 },
-#define WIDTHSW  9
+#define WIDTHSW  8
        { "width columns", 0 },
-#define SLEEPSW  10
+#define SLEEPSW  9
        { "sleep seconds",  0 },
-#define VERSIONSW  11
+#define VERSIONSW  10
        { "version", 0 },
-#define HELPSW  12
+#define HELPSW  11
        { "help", 0 },
-#define FORW1SW  13
+#define FORW1SW  12
        { "forward", -7 },
-#define FORW2SW  14
+#define FORW2SW  13
        { "forwall", -7 },
-#define DGSTSW  15
+#define DGSTSW  14
        { "digest list", -6 },
-#define VOLUMSW  16
+#define VOLUMSW  15
        { "volume number", -6 },
-#define ISSUESW  17
+#define ISSUESW  16
        { "issue number", -5 },
-#define NBODYSW  18
+#define NBODYSW  17
        { "nobody", -6 },
        { NULL, 0 }
 };
@@ -200,7 +198,6 @@ static int mhldebug = 0;
 
 #define PITTY  (-1)
 #define NOTTY  0
-#define ISTTY  1
 static int ontty = NOTTY;
 
 static int row;
@@ -271,17 +268,17 @@ void clear_screen(void);  /* from termsbr.c */
 int SOprintf(char *, ...);  /* from termsbr.c */
 int sc_width(void);  /* from termsbr.c */
 int sc_length(void);  /* from termsbr.c */
-int sc_hardcopy(void);  /* from termsbr.c */
 
 
 int
 main(int argc, char **argv)
 {
-       int length = 0, nomore = 0;
+       int length = 0;
        int i, width = 0, vecp = 0;
        char *cp, *folder = NULL, *form = NULL;
        char buf[BUFSIZ], *files[MAXARGS];
        char **argp, **arguments;
+       char *progsw = NULL;
 
 #ifdef LOCALE
        setlocale(LC_ALL, "");
@@ -348,13 +345,10 @@ main(int argc, char **argv)
                                continue;
 
                        case PROGSW:
-                               if (!(moreproc = *argp++) || *moreproc == '-')
+                               if (!(progsw = *argp++) || *progsw == '-')
                                        adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
-                       case NPROGSW:
-                               nomore++;
-                               continue;
 
                        case LENSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -415,19 +409,13 @@ main(int argc, char **argv)
                folder = getenv("mhfolder");
 
        if (isatty(fileno(stdout))) {
-               if (!nomore && !sc_hardcopy() && moreproc && *moreproc != '\0') {
-                       if (mhl_action) {
-                               SIGNAL(SIGINT, SIG_IGN);
-                               SIGNAL2(SIGQUIT, quitser);
-                       }
-                       SIGNAL2(SIGPIPE, pipeser);
-                       m_popen(moreproc);
-                       ontty = PITTY;
-               } else {
+               if (mhl_action) {
                        SIGNAL(SIGINT, SIG_IGN);
                        SIGNAL2(SIGQUIT, quitser);
-                       ontty = ISTTY;
                }
+               SIGNAL2(SIGPIPE, pipeser);
+               m_popen(progsw ? progsw : moreproc);
+               ontty = PITTY;
        } else {
                ontty = NOTTY;
        }
@@ -793,8 +781,8 @@ process(char *folder, char *fname, int ofilen, int ofilec)
                cp = folder ? concat(folder, ":", fname, NULL) : getcpy(fname);
                if (ontty != PITTY)
                        SIGNAL(SIGINT, intrser);
-               mhlfile(fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
-
+               mhlfile(fp, cp, ofilen, ofilec);
+               /* FALL THROUGH! */
        default:
                if (ontty != PITTY)
                        SIGNAL(SIGINT, SIG_IGN);
@@ -846,25 +834,6 @@ mhlfile(FILE *fp, char *mname, int ofilen, int ofilec)
                        }
                        break;
 
-               case ISTTY:
-                       strncpy(buf, "\n", sizeof(buf));
-                       if (ofilec > 1) {
-                               if (SOprintf("Press <return> to list \"%s\"...", mname)) {
-                                       if (ofilen > 1)
-                                               printf("\n\n\n");
-                                       printf("Press <return> to list \"%s\"...", mname);
-                               }
-                               fflush(stdout);
-                               buf[0] = 0;
-                               read(fileno(stdout), buf, sizeof(buf));
-                       }
-                       if (strchr(buf, '\n')) {
-                               if ((global.c_flags & CLEARSCR))
-                                       clear_screen();
-                       } else
-                               printf("\n");
-                       break;
-
                default:
                        if (ofilec > 1) {
                                if (ofilen > 1) {
@@ -1334,7 +1303,7 @@ putch(char ch)
                        llim--;
                column = 0;
                row++;
-               if (ontty != ISTTY || row != global.c_length)
+               if (row != global.c_length)
                        break;
                if (global.c_flags & BELL)
                        putchar('\007');