From fb0594cb913cab5e14e2c295b79eb48cc675bbbf Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sat, 11 Feb 2012 20:18:43 +0100 Subject: [PATCH] Made show(1) the default lproc. `list' and `display' changed a bit. Already in 1984, MTR stated, that lproc should be show. I agree with him on this point, but I strongly disagree there: ``if lproc is "mhl", use mhlproc for consistency''. I thus removed this part and even more around it. The code became simpler but additional arguments to `list' and `display' are not recognized anymore. That won't be much inconvenience. --- config/config.c | 10 ++++---- man/mh-profile.man5 | 13 ++++------ man/whatnow.man1 | 15 ------------ sbr/Makefile.in | 2 +- sbr/showfile.c | 66 --------------------------------------------------- uip/show.c | 2 +- uip/whatnow.c | 16 ++++++++----- 7 files changed, 22 insertions(+), 102 deletions(-) delete mode 100644 sbr/showfile.c diff --git a/config/config.c b/config/config.c index 8d5bd7c..2ccf379 100644 --- a/config/config.c +++ b/config/config.c @@ -136,12 +136,12 @@ char *fileproc = NMHBINDIR"/refile"; char *incproc = NMHBINDIR"/inc"; /* -** This is the default program invoked by a "list" response -** at the "What now?" prompt. It is also used by the draft -** folder facility in comp/dist/forw/repl to display the -** draft message. +** This is the default program invoked by a "list" or "display" response +** at the "What now?" prompt. It will be given the absolute pathname of +** the message to show. The string ``show -file'' is most likely what you +** want to be you lproc. */ -char *lproc = "more"; +char *lproc = "show -file"; /* ** This is the path for the Bell equivalent mail program. diff --git a/man/mh-profile.man5 b/man/mh-profile.man5 index 28fae32..2f67c63 100644 --- a/man/mh-profile.man5 +++ b/man/mh-profile.man5 @@ -400,19 +400,16 @@ is invoked with no arguments. .RE .PP .BR lproc : -more +show -file .RS 5 This program is used to list the contents of a message in response to the .B list -directive at the \*(lqWhat now?\*(rq prompt. It is -also used by the draft folder facility in -.BR comp , -.BR dist , -.BR forw , and -.B repl -to display the draft message. +.B display +directive at the \*(lqWhat now?\*(rq prompt. +The absolute pathname of the message to list will be appended to +the command line given. .RE .PP .BR mailproc : diff --git a/man/whatnow.man1 b/man/whatnow.man1 index 27a9ee5..5929523 100644 --- a/man/whatnow.man1 +++ b/man/whatnow.man1 @@ -119,21 +119,6 @@ response, any valid switch to the .I fileproc is valid. .PP -For the -.B display -and -.B list -responses, any valid argument to -the -.I lproc -is valid. If any non\-switch arguments are present, then -the pathname of the draft will be excluded from the argument list given -to the -.I lproc -(this is useful for listing another -.B nmh -message). -.PP See .BR mh\-profile (5) for further information about how editors diff --git a/sbr/Makefile.in b/sbr/Makefile.in index d05672c..f916cea 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -71,7 +71,7 @@ SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c \ readconfig.c ruserpass.c seq_add.c seq_bits.c \ seq_del.c seq_getnum.c seq_list.c seq_nameok.c \ seq_print.c seq_read.c seq_save.c seq_setcur.c \ - seq_setprev.c seq_setunseen.c showfile.c signals.c \ + seq_setprev.c seq_setunseen.c signals.c \ smatch.c snprintb.c strcasecmp.c \ strindex.c trimcpy.c uprf.c vfgets.c fmt_def.c \ m_msgdef.c mf.c utils.c m_mktemp.c diff --git a/sbr/showfile.c b/sbr/showfile.c deleted file mode 100644 index 594b269..0000000 --- a/sbr/showfile.c +++ /dev/null @@ -1,66 +0,0 @@ -/* -** showfile.c -- invoke the `lproc' command -** -** This code is Copyright (c) 2002, by the authors of nmh. See the -** COPYRIGHT file in the root directory of the nmh distribution for -** complete copyright information. -*/ - -#include - - -int -showfile(char **arg, char *file) -{ - pid_t pid; - int isdraft, vecp; - char *vec[MAXARGS]; - - context_save(); /* save the context file */ - fflush(stdout); - - /* - ** If you have your lproc listed as "mhl", - ** then really invoked the mhlproc instead - ** (which is usually mhl anyway). - */ - if (strcmp(mhbasename(lproc), "mhl")==0) - lproc = mhlproc; - - switch (pid = fork()) { - case -1: - /* fork error */ - advise("fork", "unable to"); - return 1; - - case 0: - /* child */ - vecp = 0; - vec[vecp++] = mhbasename(lproc); - isdraft = 1; - if (arg) { - while (*arg) { - if (**arg != '-') - isdraft = 0; - vec[vecp++] = *arg++; - } - } - if (isdraft) { - if (strcmp(vec[0], "show")==0) - vec[vecp++] = "-file"; - vec[vecp++] = file; - } - vec[vecp] = NULL; - - execvp(lproc, vec); - fprintf(stderr, "unable to exec "); - perror(lproc); - _exit(-1); - - default: - /* parent */ - return (pidwait(pid, -1) & 0377 ? 1 : 0); - } - - return 1; /* NOT REACHED */ -} diff --git a/uip/show.c b/uip/show.c index be85fd1..08a9b31 100644 --- a/uip/show.c +++ b/uip/show.c @@ -30,7 +30,7 @@ static struct swit switches[] = { #define SHOWMIMESW 8 { "showmimeproc program", 0 }, #define FILESW 9 - { "file file", -4 }, /* interface from showfile */ + { "file file", -4 }, /* interface from lproc (whatnow) */ #define VERSIONSW 10 { "version", 0 }, #define HELPSW 11 diff --git a/uip/whatnow.c b/uip/whatnow.c index 5b59c86..afe4129 100644 --- a/uip/whatnow.c +++ b/uip/whatnow.c @@ -66,9 +66,9 @@ static struct swit aleqs[] = { #define REFILEOPT 1 { "refile [] +folder", 0 }, #define DISPSW 2 - { "display []", 0 }, + { "display", 0 }, #define LISTSW 3 - { "list []", 0 }, + { "list", 0 }, #define SENDSW 4 { "send []", 0 }, #define PUSHSW 5 @@ -218,10 +218,13 @@ main(int argc, char **argv) switch (smatch(*argp, aleqs)) { case DISPSW: /* display the msg being replied to or distributed */ - if (msgnam) - showfile(++argp, msgnam); - else + if (msgnam) { + snprintf(buf, sizeof buf, "%s '%s'", + lproc, msgnam); + system(buf); + } else { advise(NULL, "no alternate message to display"); + } break; case EDITSW: @@ -235,7 +238,8 @@ main(int argc, char **argv) case LISTSW: /* display the draft file */ - showfile(++argp, drft); + snprintf(buf, sizeof buf, "%s '%s'", lproc, drft); + system(buf); break; case QUITSW: -- 1.7.10.4