From a4605f68e8ff04d4539e402a6fb00ff188944e1c Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Mon, 30 Jan 2012 12:42:06 +0100 Subject: [PATCH] Removed -pause from mhshow(1). My goal is to have show/mhshow generate a single stream of bytes to be piped through a pager. Content not convertable to text shall not be displayed directly. This is my idea currently. --- man/mh-chart.man1 | 1 - man/mhshow.man1 | 14 ++------- test/tests/bad-input/test-header | 2 +- test/tests/mhshow/test-cte-binary | 2 +- test/tests/mhshow/test-qp | 2 +- uip/mhshow.c | 37 +++++++--------------- uip/mhshowsbr.c | 62 ++++--------------------------------- 7 files changed, 24 insertions(+), 96 deletions(-) diff --git a/man/mh-chart.man1 b/man/mh-chart.man1 index 6a1caeb..81fbe0b 100644 --- a/man/mh-chart.man1 +++ b/man/mh-chart.man1 @@ -327,7 +327,6 @@ is equivalent to .IR content ] \&... .RB [ \-serialonly " | " \-noserialonly ] -.RB [ \-pause " | " \-nopause ] .RB [ \-form .IR formfile ] .RB [ \-rcache diff --git a/man/mhshow.man1 b/man/mhshow.man1 index 1d5d99d..bce55c1 100644 --- a/man/mhshow.man1 +++ b/man/mhshow.man1 @@ -19,7 +19,6 @@ mhshow \- display MIME messages .IR content ] \&... .RB [ \-serialonly " | " \-noserialonly ] -.RB [ \-pause " | " \-nopause ] .RB [ \-form .IR formfile ] .RB [ \-rcache @@ -230,7 +229,7 @@ The display string may contain the following escapes: %f Insert filename containing content %F %e, %f, and stdin is terminal not content %l display listing prior to displaying content -%p %l, and ask for confirmation +%p synonym to %l %s Insert content subtype %d Insert content description %% Insert the character % @@ -244,12 +243,6 @@ 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 @@ -268,8 +261,8 @@ has several default values: .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 @@ -592,7 +585,6 @@ mhbuild(1), mhl(1), mhlist(1), mhstore(1), sendfiles(1) .RB ` msgs "' defaults to cur" .RB ` \-nocheck ' .RB ` \-form mhl.headers ' -.RB ` \-pause ' .RB ` \-rcache ask ' .RB ` \-realsize ' .RB ` \-noserialonly ' diff --git a/test/tests/bad-input/test-header b/test/tests/bad-input/test-header index b9e76a1..8d466ac 100644 --- a/test/tests/bad-input/test-header +++ b/test/tests/bad-input/test-header @@ -69,7 +69,7 @@ This is a multi-part message in MIME format. I am a stupid spammer. EOF -mhshow -nopause $msgnum > $actual 2>&1 +mhshow $msgnum > $actual 2>&1 check exit $failed diff --git a/test/tests/mhshow/test-cte-binary b/test/tests/mhshow/test-cte-binary index 359d42e..53a772a 100644 --- a/test/tests/mhshow/test-cte-binary +++ b/test/tests/mhshow/test-cte-binary @@ -38,5 +38,5 @@ Content-Disposition: inline part text/plain 34 This is a test; this is the body. EOF -mhshow -nopause $msgnum > $actual 2>&1 +mhshow $msgnum > $actual 2>&1 diff -u $expected $actual diff --git a/test/tests/mhshow/test-qp b/test/tests/mhshow/test-qp index ae6ec05..74d70ee 100644 --- a/test/tests/mhshow/test-qp +++ b/test/tests/mhshow/test-qp @@ -59,5 +59,5 @@ just a newline =l = ^H (backspace) character, probably erased = in diff output EOF -mhshow -nopause $msgnum > $actual 2>&1 +mhshow $msgnum > $actual 2>&1 diff -u $expected $actual diff --git a/uip/mhshow.c b/uip/mhshow.c index b1f3d3d..1f37c0e 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -28,33 +28,29 @@ static struct swit switches[] = { { "check", 0 }, #define NCHECKSW 1 { "nocheck", 0 }, -#define PAUSESW 2 - { "pause", 0 }, -#define NPAUSESW 3 - { "nopause", 0 }, -#define SERIALSW 4 +#define SERIALSW 2 { "serialonly", 0 }, -#define NSERIALSW 5 +#define NSERIALSW 3 { "noserialonly", 0 }, -#define VERBSW 6 +#define VERBSW 4 { "verbose", 0 }, -#define NVERBSW 7 +#define NVERBSW 5 { "noverbose", 0 }, -#define FILESW 8 /* interface from show */ +#define FILESW 6 /* interface from show */ { "file file", 0 }, -#define FORMSW 9 +#define FORMSW 7 { "form formfile", 0 }, -#define PARTSW 10 +#define PARTSW 8 { "part number", 0 }, -#define TYPESW 11 +#define TYPESW 9 { "type content", 0 }, -#define RCACHESW 12 +#define RCACHESW 10 { "rcache policy", 0 }, -#define WCACHESW 13 +#define WCACHESW 11 { "wcache policy", 0 }, -#define VERSIONSW 14 +#define VERSIONSW 12 { "version", 0 }, -#define HELPSW 15 +#define HELPSW 13 { "help", 0 }, /* @@ -88,7 +84,6 @@ extern char *cache_public; extern char *cache_private; /* mhshowsbr.c */ -extern int pausesw; extern int serialsw; extern char *progsw; extern int nolist; @@ -202,13 +197,6 @@ do_cache: checksw = 0; continue; - case PAUSESW: - pausesw = 1; - continue; - case NPAUSESW: - pausesw = 0; - continue; - case SERIALSW: serialsw = 1; continue; @@ -297,7 +285,6 @@ do_cache: if ((cp = getenv("MM_NOASK")) && strcmp(cp, "1")==0) { nolist = 1; - pausesw = 0; } /* diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index ee401a7..b7452d8 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -35,7 +35,6 @@ extern int debugsw; -int pausesw = 1; int serialsw = 0; int nolist = 0; @@ -47,8 +46,6 @@ char *formsw = NULL; pid_t xpid = 0; -static sigjmp_buf intrenv; - /* termsbr.c */ int SOprintf(char *, ...); @@ -79,8 +76,7 @@ static void show_single_message(CT, char *); static void DisplayMsgHeader(CT, char *); static int show_switch(CT, int, int); static int show_content(CT, int, int); -static int show_content_aux2(CT, int, int, char *, char *, - int, int, int, int, int); +static int show_content_aux2(CT, int, int, char *, char *, int, int, int, int); static int show_text(CT, int, int); static int show_multi(CT, int, int); static int show_multi_internal(CT, int, int); @@ -88,7 +84,6 @@ static int show_multi_aux(CT, int, int, char *); static int show_message_rfc822(CT, int, int); static int show_partial(CT, int, int); static int show_external(CT, int, int); -static RETSIGTYPE intrser(int); /* @@ -333,7 +328,7 @@ int show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked) { int fd, len, buflen, quoted; - int xstdin, xlist, xpause, xtty; + int xstdin, xlist, xtty; char *bp, *pp, *file, buffer[BUFSIZ]; CI ci = &ct->c_ctinfo; @@ -352,7 +347,6 @@ show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked) return (alternate ? DONE : OK); xlist = 0; - xpause = 0; xstdin = 0; xtty = 0; @@ -430,10 +424,6 @@ show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked) break; case 'p': - /* %l, and pause prior to displaying content */ - xpause = pausesw; - /* and fall... */ - case 'l': /* ** display listing prior to displaying content @@ -526,7 +516,7 @@ raw: got_command: return show_content_aux2(ct, serial, alternate, cracked, buffer, - fd, xlist, xpause, xstdin, xtty); + fd, xlist, xstdin, xtty); } @@ -536,7 +526,7 @@ got_command: static int show_content_aux2(CT ct, int serial, int alternate, char *cracked, - char *buffer, int fd, int xlist, int xpause, int xstdin, int xtty) + char *buffer, int fd, int xlist, int xstdin, int xtty) { pid_t child_id; int i; @@ -564,33 +554,10 @@ show_content_aux2(CT ct, int serial, int alternate, char *cracked, } if (xlist) { - char prompt[BUFSIZ]; - if (ct->c_type == CT_MULTIPART) list_content(ct, -1, 1, 0, 0); else list_switch(ct, -1, 1, 0, 0); - - if (xpause && SOprintf("Press to show content...")) - printf("Press to show content..."); - - if (xpause) { - int intr; - SIGNAL_HANDLER istat; - - 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); - } } snprintf(exec, sizeof(exec), "exec %s", buffer); @@ -860,7 +827,7 @@ static int show_multi_aux(CT ct, int serial, int alternate, char *cp) { int len, buflen, quoted; - int xlist, xpause, xtty; + int xlist, xtty; char *bp, *pp, *file, buffer[BUFSIZ]; struct multipart *m = (struct multipart *) ct->c_ctparams; struct part *part; @@ -891,7 +858,6 @@ show_multi_aux(CT ct, int serial, int alternate, char *cp) } xlist = 0; - xpause = 0; xtty = 0; /* get buffer ready to go */ @@ -970,10 +936,6 @@ show_multi_aux(CT ct, int serial, int alternate, char *cp) break; case 'p': - /* %l, and pause prior to displaying content */ - xpause = pausesw; - /* and fall... */ - case 'l': /* ** display listing prior to displaying content @@ -1066,7 +1028,7 @@ raw: } return show_content_aux2(ct, serial, alternate, NULL, buffer, - NOTOK, xlist, xpause, 0, xtty); + NOTOK, xlist, 0, xtty); } @@ -1143,15 +1105,3 @@ show_external(CT ct, int serial, int alternate) return NOTOK; #endif } - - -static RETSIGTYPE -intrser(int i) -{ -#ifndef RELIABLE_SIGNALS - SIGNAL(SIGINT, intrser); -#endif - - putchar('\n'); - siglongjmp(intrenv, DONE); -} -- 1.7.10.4