Removed the -bell option from mhl.
[mmh] / uip / mhl.c
index d3b7429..ef5f860 100644 (file)
--- a/uip/mhl.c
+++ b/uip/mhl.c
 #define QUOTE  '\\'
 
 static struct swit mhlswitches[] = {
-#define BELLSW  0
-       { "bell", 0 },
-#define NBELLSW  1
-       { "nobell", 0 },
-#define CLRSW  2
+#define CLRSW  0
        { "clear", 0 },
-#define NCLRSW  3
+#define NCLRSW  1
        { "noclear", 0 },
-#define FOLDSW  4
+#define FOLDSW  2
        { "folder +folder", 0 },
-#define FORMSW  5
+#define FORMSW  3
        { "form formfile", 0 },
-#define PROGSW  6
+#define PROGSW  4
        { "moreproc program", 0 },
-#define NPROGSW  7
-       { "nomoreproc", 0 },
-#define LENSW  8
+#define LENSW  5
        { "length lines", 0 },
-#define WIDTHSW  9
+#define WIDTHSW  6
        { "width columns", 0 },
-#define SLEEPSW  10
+#define SLEEPSW  7
        { "sleep seconds",  0 },
-#define VERSIONSW  11
+#define VERSIONSW  8
        { "version", 0 },
-#define HELPSW  12
+#define HELPSW  9
        { "help", 0 },
-#define FORW1SW  13
+#define FORW1SW  10
        { "forward", -7 },
-#define FORW2SW  14
+#define FORW2SW  11
        { "forwall", -7 },
-#define DGSTSW  15
+#define DGSTSW  12
        { "digest list", -6 },
-#define VOLUMSW  16
+#define VOLUMSW  13
        { "volume number", -6 },
-#define ISSUESW  17
+#define ISSUESW  14
        { "issue number", -5 },
-#define NBODYSW  18
+#define NBODYSW  15
        { "nobody", -6 },
        { NULL, 0 }
 };
@@ -92,13 +86,12 @@ static struct swit mhlswitches[] = {
 #define LEFTADJUST  0x000080  /* left justify multiple lines */
 #define COMPRESS    0x000100  /* compress text               */
 #define ADDRFMT     0x000200  /* contains addresses          */
-#define BELL        0x000400  /* sound bell at EOP           */
-#define DATEFMT     0x000800  /* contains dates              */
-#define FORMAT      0x001000  /* parse address/date/RFC-2047 field */
-#define INIT        0x002000  /* initialize component        */
-#define SPLIT       0x004000  /* split headers (don't concatenate) */
-#define NONEWLINE   0x008000  /* don't write trailing newline */
-#define LBITS       "\020\01NOCOMPONENT\02UPPERCASE\03CENTER\04CLEARTEXT\05EXTRA\06HDROUTPUT\07CLEARSCR\010LEFTADJUST\011COMPRESS\012ADDRFMT\013BELL\014DATEFMT\015FORMAT\016INIT\017SPLIT\020NONEWLINE"
+#define DATEFMT     0x000400  /* contains dates              */
+#define FORMAT      0x000800  /* parse address/date/RFC-2047 field */
+#define INIT        0x001000  /* initialize component        */
+#define SPLIT       0x002000  /* split headers (don't concatenate) */
+#define NONEWLINE   0x004000  /* don't write trailing newline */
+#define LBITS       "\020\01NOCOMPONENT\02UPPERCASE\03CENTER\04CLEARTEXT\05EXTRA\06HDROUTPUT\07CLEARSCR\010LEFTADJUST\011COMPRESS\012ADDRFMT\013DATEFMT\014FORMAT\015INIT\016SPLIT\017NONEWLINE"
 #define GFLAGS      (NOCOMPONENT | UPPERCASE | CENTER | LEFTADJUST | COMPRESS | SPLIT)
 
 struct mcomp {
@@ -122,7 +115,7 @@ static struct mcomp *fmthd = NULL;
 static struct mcomp *fmttl = NULL;
 
 static struct mcomp global = {
-       NULL, NULL, "", NULL, NULL, 0, -1, 80, -1, 40, BELL, 0
+       NULL, NULL, "", NULL, NULL, 0, -1, 80, -1, 40, 0, 0
 };
 
 static struct mcomp holder = {
@@ -174,8 +167,6 @@ static struct triple triples[] = {
        { "split", SPLIT, 0 },
        { "nosplit", 0, SPLIT },
        { "addrfield", ADDRFMT, DATEFMT },
-       { "bell", BELL, 0 },
-       { "nobell", 0, BELL },
        { "datefield", DATEFMT, ADDRFMT },
        { "newline", 0, NONEWLINE },
        { "nonewline", NONEWLINE, 0 },
@@ -183,7 +174,6 @@ static struct triple triples[] = {
 };
 
 
-static int bellflg   = 0;
 static int clearflg  = 0;
 static int dobody    = 1;
 static int forwflg   = 0;
@@ -200,7 +190,6 @@ static int mhldebug = 0;
 
 #define PITTY  (-1)
 #define NOTTY  0
-#define ISTTY  1
 static int ontty = NOTTY;
 
 static int row;
@@ -271,17 +260,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, "");
@@ -315,13 +304,6 @@ main(int argc, char **argv)
                                print_version(invo_name);
                                done(1);
 
-                       case BELLSW:
-                               bellflg = 1;
-                               continue;
-                       case NBELLSW:
-                               bellflg = -1;
-                               continue;
-
                        case CLRSW:
                                clearflg = 1;
                                continue;
@@ -348,13 +330,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 +394,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;
        }
@@ -517,7 +490,7 @@ mhl_format(char *file, int length, int width)
        global.c_cwidth = -1;
        if ((i = sc_length()) > 5)
                global.c_length = i - 1;
-       global.c_flags = BELL;  /* BELL is default */
+       global.c_flags = 0;
        *(ip = ignores) = NULL;
 
        while (vfgets(fp, &ap) == OK) {
@@ -616,15 +589,6 @@ out:
                        global.c_flags &= ~CLEARSCR;
        }
 
-       switch (bellflg) {  /* command line may override format file */
-       case 1:
-               global.c_flags |= BELL;
-               break;
-       case -1:
-               global.c_flags &= ~BELL;
-               break;
-       }
-
        if (length)
                global.c_length = length;
        if (width)
@@ -793,8 +757,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 +810,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,10 +1279,8 @@ 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');
                fflush(stdout);
                buf[0] = 0;
                read(fileno(stdout), buf, sizeof(buf));