From: Ken Hornstein Date: Fri, 21 Mar 2014 18:22:58 +0000 (-0400) Subject: Remove support for -pause/-nopause switches to mhshow(1). This and X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/54483f16238902dcd920de1f6056df6cb0a0d8cf Remove support for -pause/-nopause switches to mhshow(1). This and commit 4c436246f048635446353dadaa68174445c58160 are based on work originally done by Markus Schnalke. --- diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 6be3d54b..8c02d845 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -135,6 +135,7 @@ OBSOLETE FEATURES - Support for parallel display of multipart/parallel content has been removed from mhshow; all multipart content will be displayed in serial. +- Support for -pause/-nopause switches on mhshow has been removed. ------------------- DEPRECATED FEATURES diff --git a/man/mhshow.man b/man/mhshow.man index 482229e9..b6fe8838 100644 --- a/man/mhshow.man +++ b/man/mhshow.man @@ -18,7 +18,6 @@ mhshow \- display MIME messages .RB [ \-type .IR content ] \&... -.RB [ \-pause " | " \-nopause ] .RB [ \-form .IR formfile ] .RB [ \-rcache @@ -227,34 +226,19 @@ The display string may contain the following escapes: %a Insert parameters from Content-Type field %{parameter} Insert the parameter value from the Content-Type field %f Insert filename containing content -%F %e, %f, and stdin is terminal not content +%F %f, and stdin is terminal not content %l display listing prior to displaying content -%p %l, and ask for confirmation %s Insert content subtype %d Insert content description %% Insert the character % .fi .RE .PP -For those display strings containing the e- or F-escape, -.B mhshow +.B Mhshow will -execute at most one of these at any given time. Although the F-escape -expands to be the filename containing the content, the e-escape has no -expansion as far as the shell is concerned. -.PP -When the p-escape prompts for confirmation, typing INTR (usually -control-C) will tell -.B mhshow -not to display that content. -The p-escape can be disabled by specifying the switch -.BR \-nopause . -Further, when -.B mhshow -is display a content, typing QUIT (usually -control-\\) will tell -.B mhshow -to wrap things up immediately. +execute at most one display string at any given time, and wait for the +current display string to finish execution before executing the next +display string. .PP The {parameter} escape is typically used in a command line argument that should only be present if it has a non-null value. Its value @@ -287,8 +271,8 @@ behaves as if these profile entries were supplied and supported: .PP .RS 5 .nf -mhshow-show-text/plain: %pmoreproc %F -mhshow-show-message/rfc822: %pshow -file %F +mhshow-show-text/plain: %lmoreproc %F +mhshow-show-message/rfc822: %lshow -file %F .fi .RE .PP @@ -636,7 +620,6 @@ is checked. .RB ` msgs "' defaults to cur" .RB ` \-nocheck ' .RB ` \-form\ mhl.headers ' -.RB ` \-pause ' .RB ` \-rcache\ ask ' .RB ` \-wcache\ ask ' .fi diff --git a/test/bad-input/test-header b/test/bad-input/test-header index 1bc05f47..ea5385fa 100755 --- a/test/bad-input/test-header +++ b/test/bad-input/test-header @@ -71,7 +71,7 @@ This is a multi-part message in MIME format. I am a stupid spammer. EOF -run_prog mhshow -nopause last > "$actual" 2>&1 +run_prog mhshow last > "$actual" 2>&1 check "$expected" "$actual" # check m_getfld() handling of empty header field diff --git a/test/mhshow/test-charset b/test/mhshow/test-charset index d0d8028b..974442c6 100755 --- a/test/mhshow/test-charset +++ b/test/mhshow/test-charset @@ -50,7 +50,7 @@ part text/plain 10 This is a test EOF -run_prog mhshow -nopause $msgnum > $actual 2>&1 +run_prog mhshow $msgnum > $actual 2>&1 check "$expected" "$actual" exit $failed diff --git a/test/mhshow/test-cte-binary b/test/mhshow/test-cte-binary index 9c31a657..ce9045b5 100755 --- a/test/mhshow/test-cte-binary +++ b/test/mhshow/test-cte-binary @@ -46,7 +46,7 @@ Content-Disposition: inline part text/plain 34 This is a test; this is the body. EOF -run_prog mhshow -nopause $msgnum > $actual 2>&1 +run_prog mhshow $msgnum > $actual 2>&1 check "$expected" "$actual" exit $failed diff --git a/test/mhshow/test-msg-buffer-boundaries b/test/mhshow/test-msg-buffer-boundaries index a05a1b4f..684a5389 100755 --- a/test/mhshow/test-msg-buffer-boundaries +++ b/test/mhshow/test-msg-buffer-boundaries @@ -157,7 +157,7 @@ part 1.1 text/plain 29 This is the text/plain part. EOF -run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1 +run_prog mhshow -part 1.1 -form mhl.null $msgnum >"$actual" 2>&1 check "$expected" "$actual" # check a boundary condition in m_getfld(): its internal message @@ -297,7 +297,7 @@ part 1.1 text/plain 29 This is the text/plain part. EOF -run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1 +run_prog mhshow -part 1.1 -form mhl.null $msgnum >"$actual" 2>&1 check "$expected" "$actual" # check a boundary condition in m_getfld(): its internal message @@ -385,7 +385,7 @@ part 1.1 text/plain 29 This is the text/plain part. EOF -run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum >"$actual" 2>&1 +run_prog mhshow -part 1.1 -form mhl.null $msgnum >"$actual" 2>&1 check "$expected" "$actual" diff --git a/test/mhshow/test-qp b/test/mhshow/test-qp index 96b2969d..db3e073a 100755 --- a/test/mhshow/test-qp +++ b/test/mhshow/test-qp @@ -68,7 +68,7 @@ just a newline =l = ^H (backspace) character, probably erased = in diff output EOF -run_prog mhshow -nopause $msgnum > $actual 2>&1 +run_prog mhshow $msgnum > $actual 2>&1 check "$expected" "$actual" exit $failed diff --git a/test/mhshow/test-subpart b/test/mhshow/test-subpart index 0d152bb3..2fb74b48 100755 --- a/test/mhshow/test-subpart +++ b/test/mhshow/test-subpart @@ -56,7 +56,7 @@ This is the text/plain part. EOF # check it -run_prog mhshow -part 1.1 -form mhl.null -nopause $msgnum > $actual 2>&1 +run_prog mhshow -part 1.1 -form mhl.null $msgnum > $actual 2>&1 check "$expected" "$actual" exit $failed diff --git a/test/mhshow/test-textcharset b/test/mhshow/test-textcharset index fae8c287..9fad5d8d 100755 --- a/test/mhshow/test-textcharset +++ b/test/mhshow/test-textcharset @@ -51,7 +51,7 @@ part text/plain 10 4 ÷ 2 = 2 EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" cat >>"$MH" <<'EOF' @@ -84,7 +84,7 @@ MIME-Version: 1.0 UTF-8 EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" @@ -113,7 +113,7 @@ MIME-Version: 1.0 EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" @@ -135,7 +135,7 @@ MIME-Version: 1.0 -I UTF-8 EOF -run_prog mhshow -nopause prev >"$actual" 2>&1 +run_prog mhshow prev >"$actual" 2>&1 check "$expected" "$actual" @@ -151,7 +151,7 @@ MIME-Version: 1.0 EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" @@ -170,7 +170,7 @@ MIME-Version: 1.0 -I UTF-8 file EOF -run_prog mhshow -nopause prev >"$actual" 2>&1 +run_prog mhshow prev >"$actual" 2>&1 check "$expected" "$actual" @@ -186,7 +186,7 @@ MIME-Version: 1.0 file EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" @@ -218,7 +218,7 @@ MIME-Version: 1.0 -I $QUOTEME' file EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" @@ -250,7 +250,7 @@ MIME-Version: 1.0 file EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" @@ -283,7 +283,7 @@ MIME-Version: 1.0 EOF -run_prog mhshow -nopause last >"$actual" 2>&1 +run_prog mhshow last >"$actual" 2>&1 check "$expected" "$actual" diff --git a/uip/mhn.c b/uip/mhn.c index 7f85ae55..09aa1671 100644 --- a/uip/mhn.c +++ b/uip/mhn.c @@ -29,8 +29,6 @@ X("noheaders", 0, NHEADSW) \ X("list", 0, LISTSW) \ X("nolist", 0, NLISTSW) \ - X("pause", 0, PAUSESW) \ - X("nopause", 0, NPAUSESW) \ X("realsize", 0, SIZESW) \ X("norealsize", 0, NSIZESW) \ X("show", 0, SHOWSW) \ @@ -82,7 +80,6 @@ extern char *cache_public; extern char *cache_private; /* mhshowsbr.c */ -extern int pausesw; extern char *progsw; extern int nolist; extern int nomore; /* flags for moreproc/header display */ @@ -241,13 +238,6 @@ do_cache: listsw = 0; continue; - case PAUSESW: - pausesw = 1; - continue; - case NPAUSESW: - pausesw = 0; - continue; - case SHOWSW: showsw = 1; continue; diff --git a/uip/mhshow.c b/uip/mhshow.c index fdad6e13..e897f2b6 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -21,8 +21,6 @@ #define MHSHOW_SWITCHES \ X("check", 0, CHECKSW) \ X("nocheck", 0, NCHECKSW) \ - X("pause", 0, PAUSESW) \ - X("nopause", 0, NPAUSESW) \ X("verbose", 0, VERBSW) \ X("noverbose", 0, NVERBSW) \ X("file file", 0, FILESW) \ @@ -61,7 +59,6 @@ extern char *cache_public; extern char *cache_private; /* mhshowsbr.c */ -extern int pausesw; extern char *progsw; extern int nomore; /* flags for moreproc/header display */ extern char *formsw; @@ -165,13 +162,6 @@ do_cache: checksw = 0; continue; - case PAUSESW: - pausesw = 1; - continue; - case NPAUSESW: - pausesw = 0; - continue; - case PARTSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 545f78c9..207a8e5d 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -23,7 +23,6 @@ extern int debugsw; -int pausesw = 1; int nolist = 0; char *progsw = NULL; @@ -32,8 +31,6 @@ char *progsw = NULL; int nomore = 0; char *formsw = NULL; -static sigjmp_buf intrenv; - /* mhmisc.c */ int part_ok (CT, int); @@ -54,7 +51,7 @@ static void show_single_message (CT, char *); static void DisplayMsgHeader (CT, char *); static int show_switch (CT, int); static int show_content (CT, int); -static int show_content_aux2 (CT, int, char *, char *, int, int, int, int); +static int show_content_aux2 (CT, int, char *, char *, int, int, int); static int show_text (CT, int); static int show_multi (CT, int); static int show_multi_internal (CT, int); @@ -62,10 +59,9 @@ static int show_multi_aux (CT, int, char *); static int show_message_rfc822 (CT, int); static int show_partial (CT, int); static int show_external (CT, int); -static int parse_display_string (CT, char *, int *, int *, int *, char *, - char *, size_t, int multipart); +static int parse_display_string (CT, char *, int *, int *, char *, char *, + size_t, int multipart); static int convert_content_charset (CT, char **); -static void intrser (int); /* @@ -290,7 +286,7 @@ int show_content_aux (CT ct, int alternate, char *cp, char *cracked) { int fd; - int xstdin = 0, xlist = 0, xpause = 0; + int xstdin = 0, xlist = 0; char *file, buffer[BUFSIZ]; if (!ct->c_ceopenfnx) { @@ -325,15 +321,15 @@ show_content_aux (CT ct, int alternate, char *cp, char *cracked) goto got_command; } - if (parse_display_string (ct, cp, &xstdin, &xlist, &xpause, file, - buffer, sizeof(buffer) - 1, 0)) { + if (parse_display_string (ct, cp, &xstdin, &xlist, file, buffer, + sizeof(buffer) - 1, 0)) { admonish (NULL, "Buffer overflow constructing show command!\n"); return NOTOK; } got_command: return show_content_aux2 (ct, alternate, cracked, buffer, - fd, xlist, xpause, xstdin); + fd, xlist, xstdin); } @@ -343,7 +339,7 @@ got_command: static int show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer, - int fd, int xlist, int xpause, int xstdin) + int fd, int xlist, int xstdin) { pid_t child_id; int i, vecp; @@ -363,33 +359,10 @@ show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer, } if (xlist) { - char prompt[BUFSIZ]; - if (ct->c_type == CT_MULTIPART) list_content (ct, -1, 1, 0, 0, 0); else list_switch (ct, -1, 1, 0, 0, 0); - - if (xpause && isatty (fileno (stdout))) { - int intr; - SIGNAL_HANDLER istat; - - if (SOprintf ("Press to show content...")) - printf ("Press to show content..."); - - istat = SIGNAL (SIGINT, intrser); - if ((intr = sigsetjmp (intrenv, 1)) == OK) { - fflush (stdout); - prompt[0] = 0; - read (fileno (stdout), prompt, sizeof(prompt)); - } - SIGNAL (SIGINT, istat); - if (intr != OK || prompt[0] == 'n') { - (*ct->c_ceclosefnx) (ct); - return (alternate ? DONE : NOTOK); - } - if (prompt[0] == 'q') done(OK); - } } vec = argsplit(buffer, &file, &vecp); @@ -455,7 +428,7 @@ show_text (CT ct, int alternate) * if it is not a text part of a multipart/alternative */ if (!alternate || ct->c_subtype == TEXT_PLAIN) { - snprintf (buffer, sizeof(buffer), "%%p%s %%F", progsw ? progsw : + snprintf (buffer, sizeof(buffer), "%%l%s %%F", progsw ? progsw : moreproc && *moreproc ? moreproc : DEFAULT_PAGER); cp = (ct->c_showproc = add (buffer, NULL)); return show_content_aux (ct, alternate, cp, NULL); @@ -580,7 +553,7 @@ show_multi_aux (CT ct, int alternate, char *cp) { /* xstdin is only used in the call to parse_display_string(): its value is ignored in the function. */ - int xstdin = 0, xlist = 0, xpause = 0; + int xstdin = 0, xlist = 0; char *file, buffer[BUFSIZ]; struct multipart *m = (struct multipart *) ct->c_ctparams; struct part *part; @@ -608,14 +581,13 @@ show_multi_aux (CT ct, int alternate, char *cp) } } - if (parse_display_string (ct, cp, &xstdin, &xlist, &xpause, file, + if (parse_display_string (ct, cp, &xstdin, &xlist, file, buffer, sizeof(buffer) - 1, 1)) { admonish (NULL, "Buffer overflow constructing show command!\n"); return NOTOK; } - return show_content_aux2 (ct, alternate, NULL, buffer, - NOTOK, xlist, xpause, 0); + return show_content_aux2 (ct, alternate, NULL, buffer, NOTOK, xlist, 0); } @@ -692,7 +664,7 @@ show_external (CT ct, int alternate) static int -parse_display_string (CT ct, char *cp, int *xstdin, int *xlist, int *xpause, +parse_display_string (CT ct, char *cp, int *xstdin, int *xlist, char *file, char *buffer, size_t buflen, int multipart) { int len, quoted = 0; @@ -739,7 +711,7 @@ parse_display_string (CT ct, char *cp, int *xstdin, int *xlist, int *xpause, break; case 'F': - /* %e, %f, and stdin is terminal not content */ + /* %f, and stdin is terminal not content */ *xstdin = 1; /* and fall... */ @@ -794,8 +766,7 @@ parse_display_string (CT ct, char *cp, int *xstdin, int *xlist, int *xpause, break; case 'p': - /* %l, and pause prior to displaying content */ - *xpause = pausesw; + /* No longer supported */ /* and fall... */ case 'l': @@ -1139,13 +1110,3 @@ convert_content_charset (CT ct, char **file) { return OK; } - - -static void -intrser (int i) -{ - NMH_UNUSED (i); - - putchar ('\n'); - siglongjmp (intrenv, DONE); -}