From f51956be123db66b00138f80464d06f030dbb88d Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 10 Feb 2012 10:20:47 +0100 Subject: [PATCH] Removed `-format string' switches but made -form accept `=formatstring'. For all tools that take `-from file' or `-format string' switches, those were merged: `-format string' went away, but one may supply any such string to the -form switch by prepending it with an equal sign `='. Thus scan -format '%(msg) %{from}' is now written as scan -form '=%(msg) %{from}' Note: mhl isn't adjusted this way, yet. It's too complex to be understood by me, now. Thus, it still remains as it was: Any parameter to -form will be interepreted as a filter *file*. As show and mhshow use mhl, they are affected, too. In the same go: Compactified the new_fs() function: folded the arguments. --- h/fmt_scan.h | 1 - h/prototypes.h | 2 +- h/scansbr.h | 2 +- man/ap.man8 | 23 ++++++++++---------- man/dp.man8 | 20 +++++++++--------- man/fmtdump.man8 | 10 ++------- man/inc.man1 | 8 ++----- man/mh-chart.man1 | 12 ----------- man/mhl.man1 | 13 ++++++++++++ man/rcvtty.man1 | 7 +----- man/scan.man1 | 18 +++++++--------- sbr/fmt_new.c | 61 +++++++++++++++++++++++++++-------------------------- uip/ap.c | 24 +++++++-------------- uip/comp.c | 2 +- uip/dist.c | 2 +- uip/dp.c | 21 ++++++------------ uip/fmtdump.c | 17 ++++----------- uip/forw.c | 4 ++-- uip/inc.c | 27 ++++++++---------------- uip/mhlsbr.c | 6 ++++-- uip/rcvdist.c | 2 +- uip/rcvtty.c | 28 ++++++++---------------- uip/repl.c | 2 +- uip/scan.c | 21 ++++++------------ 24 files changed, 133 insertions(+), 200 deletions(-) diff --git a/h/fmt_scan.h b/h/fmt_scan.h index 713c89b..a205868 100644 --- a/h/fmt_scan.h +++ b/h/fmt_scan.h @@ -88,5 +88,4 @@ struct format { ** prototypes */ struct format *fmt_scan(struct format *, char *, int, int *); -char *new_fs(char *, char *, char *, char *); int fmt_compile(char *, struct format **); diff --git a/h/prototypes.h b/h/prototypes.h index 01c6a59..46a89ce 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -80,7 +80,7 @@ void m_unknown(FILE *); int makedir(char *); char *nmh_getpass(const char *); char *norm_charmap(char *); -char *new_fs(char *, char *, char *, char *); +char *new_fs(char *, char *); int peekc(FILE *ib); int pidwait(pid_t, int); int pidstatus(int, FILE *, char *); diff --git a/h/scansbr.h b/h/scansbr.h index f7a8e37..bf2e88f 100644 --- a/h/scansbr.h +++ b/h/scansbr.h @@ -15,7 +15,7 @@ extern char *scanl; ** default format for `scan' and `inc' */ # define FORMAT \ -"%4(msg)%<(cur)+%| %>%<{replied}-%?{encrypted}E%| %>\ +"=%4(msg)%<(cur)+%| %>%<{replied}-%?{encrypted}E%| %>\ %4(year{date})-%02(mon{date})-%02(mday{date}) \ %<(mymbox{from})%<{to}To:%14(decode(friendly{to}))%>%>\ %<(zero)%17(decode(friendly{from}))%> %(decode{subject})\n" diff --git a/man/ap.man8 b/man/ap.man8 index af967df..b0ae615 100644 --- a/man/ap.man8 +++ b/man/ap.man8 @@ -10,8 +10,6 @@ ap \- parse addresses 822-style .B %libdir%/ap .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-normalize " | " \-nonormalize ] .RB [ \-width .IR columns ] @@ -37,14 +35,15 @@ usually best to enclose each argument in double\-quotes for the shell. To override the output format used by .BR ap , the -.B \-format -.I string -or -.B \-format +.B \-form .I file -switches are used. This permits individual fields of -the address to be extracted with ease. The string is simply a format -string, and the file is simply a format file. See +switch is used. This permits individual fields of +the address to be extracted with ease. +The +.I file +is either the name of a format file or it may be +a format string directly, if prepended with an equal sign `='. +See .BR mh\-format (5) for the details. .PP @@ -71,7 +70,9 @@ Here is the default format string used by .BR ap : .PP .RS 5 +.nf %<{error}%{error}: %{text}%|%(putstr(proper{text}))%> +.fi .RE .PP which says that if an error was detected, print the error, a `:', and @@ -95,7 +96,7 @@ dp(8), .SH DEFAULTS .nf -.RB ` \-format "' defaults as described above" +.RB ` \-form "' defaults as described above" .RB ` \-normalize ' .RB ` \-width "' defaults to the width of the terminal" .fi @@ -105,7 +106,7 @@ None .SH BUGS The argument to the -.B \-format +.B \-form switch must be interpreted as a single token by the shell that invokes .BR ap . diff --git a/man/dp.man8 b/man/dp.man8 index 2742806..d07fa6b 100644 --- a/man/dp.man8 +++ b/man/dp.man8 @@ -10,8 +10,6 @@ dp \- parse dates 822-style .B %libdir%/dp .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-width .IR columns ] .RB [ \-version ] @@ -39,14 +37,14 @@ shell. To override the output format used by .BR dp , the -.B \-format -.I string -or -.B \-format +.B \-form .I file -switches are used. +switch is used. This permits individual fields of the address to be extracted with ease. -The string is simply a format string and the file is simply a format file. +The +.I file +is either the name of a format file or +a format string directly, if prepended with an equal sign `='. See .BR mh\-format (5) for the details. @@ -55,7 +53,9 @@ Here is the default format string used by .BR dp : .PP .RS 5 +.nf %<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%> +.fi .RE .PP which says that if an error was detected, print the error, a `:', @@ -79,7 +79,7 @@ ap(8), .SH DEFAULTS .nf -.RB ` \-format "' default as described above" +.RB ` \-form "' default as described above" .RB ` \-width "' default to the width of the terminal" .fi @@ -88,7 +88,7 @@ None .SH BUGS The argument to the -.B \-format +.B \-form switch must be interpreted as a single token by the shell that invokes .BR dp . Therefore, one must usually place the argument to this switch inside double\-quotes. diff --git a/man/fmtdump.man8 b/man/fmtdump.man8 index 55f9b99..0acb412 100644 --- a/man/fmtdump.man8 +++ b/man/fmtdump.man8 @@ -10,8 +10,6 @@ fmtdump \- decode nmh format files .B %libdir%/fmtdump .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-version ] .RB [ \-help ] .ad @@ -24,14 +22,10 @@ format file and produces a pseudo-language listing of the how interprets the file. This is useful when debugging a complicated format file. .PP The -.B \-format -.I string -and .B \-form .I formatfile -switches may be -used to specify a format string or format file to read. The string -is simply a format string and the file is simply a format file. +switch may be used to specify a format file to read. +It may also be a format string directly, if prepended with an equal sign `='. See .BR mh-format (5) for the details. diff --git a/man/inc.man1 b/man/inc.man1 index 40a04c5..1abc45b 100644 --- a/man/inc.man1 +++ b/man/inc.man1 @@ -15,8 +15,6 @@ inc \- incorporate new mail .RB [ \-changecur " | " \-nochangecur ] .RB [ \-form .IR formfile ] -.RB [ \-format -.IR string ] .RB [ \-file .IR name ] .RB [ \-silent " | " \-nosilent ] @@ -112,8 +110,6 @@ will not zero each sequence prior to adding messages. The interpretation of the .B \-form .IR formatfile , -.B \-format -.IR string , and .B \-width .I columns @@ -187,7 +183,7 @@ mhmail(1), scan(1), mh\-mail(5), post(8) .RB ` +folder "' defaulted by \*(lqInbox\*(rq above" .RB ` \-noaudit ' .RB ` \-changecur ' -.RB ` \-format "' defaulted as described above" +.RB ` \-form "' defaulted as described above" .RB ` \-nosilent ' .RB ` \-truncate "' if `" \-file " name' not given, `" \-notruncate "' otherwise" .RB ` \-width "' defaulted to the width of the terminal" @@ -204,7 +200,7 @@ of the first new message. .SH BUGS The argument to the -.B \-format +.B \-form switch must be interpreted as a single token by the shell that invokes .BR inc . diff --git a/man/mh-chart.man1 b/man/mh-chart.man1 index 5105268..25e27af 100644 --- a/man/mh-chart.man1 +++ b/man/mh-chart.man1 @@ -33,8 +33,6 @@ mh-chart \- Chart of nmh Commands .B %libdir%/ap .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-normalize " | " \-nonormalize ] .RB [ \-width .IR columns ] @@ -100,8 +98,6 @@ mh-chart \- Chart of nmh Commands .B %libdir%/dp .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-width .IR columns ] .RB [ \-version ] @@ -137,8 +133,6 @@ is equivalent to .B %libdir%/fmtdump .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-version ] .RB [ \-help ] @@ -207,8 +201,6 @@ is equivalent to .RB [ \-changecur " | " \-nochangecur ] .RB [ \-form .IR formfile ] -.RB [ \-format -.IR string ] .RB [ \-file .IR name ] .RB [ \-silent " | " \-nosilent ] @@ -491,8 +483,6 @@ or .RI [ command ] .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-width .IR columns ] .RB [ \-bell " | " \-nobell ] @@ -571,8 +561,6 @@ all/to/cc/me] .RB [ \-clear " | " \-noclear ] .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-width .IR columns ] .RB [ \-file diff --git a/man/mhl.man1 b/man/mhl.man1 index d687eef..b910f4d 100644 --- a/man/mhl.man1 +++ b/man/mhl.man1 @@ -132,6 +132,12 @@ can be changed by using the .B \-form .I formatfile switch. +Note: In contrast to any other +.B mmh +tool, the +.B \-form +switch does only take file names, but no format strings with a prepended +equal sign `='. .PP Finally, the .B \-folder @@ -346,6 +352,13 @@ show(1), ap(8), dp(8) None .SH BUGS +In contrast to any other +.B mmh +tool, the +.B \-form +switch does only take file names, but no format strings with a prepended +equal sign `='. +.PP There should be some way to pass `bell' and `clear' information to the front\-end. .PP diff --git a/man/rcvtty.man1 b/man/rcvtty.man1 index 3a141e3..b3112dd 100644 --- a/man/rcvtty.man1 +++ b/man/rcvtty.man1 @@ -11,8 +11,6 @@ rcvtty \- report new mail .RI [ command ] .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-width .IR columns ] .RB [ \-bell " | " \-nobell ] @@ -38,12 +36,9 @@ its standard input, and writes the resulting output on your terminal. Alternately, if no command is specified (or is bogus), then .B rcvtty will instead write a one\-line scan listing. The default output format -of this scan listing may be overridden by using either the +of this scan listing may be overridden by using the .B \-form .I formatfile -or -.B \-format -.I string option, similar to the equivalent options for .B scan diff --git a/man/scan.man1 b/man/scan.man1 index 1732895..2b9c0f6 100644 --- a/man/scan.man1 +++ b/man/scan.man1 @@ -13,8 +13,6 @@ scan \- produce a one line per message scan listing .RB [ \-clear " | " \-noclear ] .RB [ \-form .IR formatfile ] -.RB [ \-format -.IR string ] .RB [ \-width .IR columns ] .RB [ \-file @@ -124,14 +122,14 @@ concatenated, separated by a one\-line header and two blank lines. To override the output format used by .BR scan , the -.B \-format -.I string -or .B \-form .I file -switches are used. This permits individual fields of -the scan listing to be extracted with ease. The string is simply a format -string and the file is simply a format file. See +switch is used. This permits individual fields of +the scan listing to be extracted with ease. +.I file +is either the name of a format file or a format string directly, +if prepended with an equal sign `='. +See .BR mh\-format (5) for the details. .PP @@ -196,7 +194,7 @@ inc(1), pick(1), show(1), mh\-format(5) .nf .RB ` +folder "' defaults to the current folder" .RB ` msgs "' defaults to all" -.RB ` \-format "' defaulted as described above" +.RB ` \-form "' defaulted as described above" .RB ` \-width "' defaulted to the width of the terminal" .fi @@ -205,7 +203,7 @@ If a folder is given, it will become the current folder. .SH BUGS The argument to the -.B \-format +.B \-form switch must be interpreted as a single token by the shell that invokes .BR scan . diff --git a/sbr/fmt_new.c b/sbr/fmt_new.c index 6cdcfcc..9fd34c8 100644 --- a/sbr/fmt_new.c +++ b/sbr/fmt_new.c @@ -21,7 +21,7 @@ static void normalize(char *); ** Copy first available format string, store in static memory and normalize it. */ char * -new_fs(char *form, char *format, char *def_form, char *default_fs) +new_fs(char *form, char *def_form) { struct stat st; register FILE *fp; @@ -31,38 +31,39 @@ new_fs(char *form, char *format, char *def_form, char *default_fs) } if (form) { - if ((fp = fopen(etcpath(form), "r")) == NULL) { - adios(form, "unable to open format file"); + if (*form == '=') { + formats = getcpy(form+1); + } else { + if ((fp = fopen(etcpath(form), "r")) == NULL) { + adios(form, "unable to open format file"); + } + if (fstat(fileno(fp), &st) == -1) { + adios(form, "unable to stat format file"); + } + formats = mh_xmalloc((size_t) st.st_size + 1); + if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) { + adios(form, "error reading format file"); + } + formats[st.st_size] = '\0'; + fclose(fp); } - if (fstat(fileno(fp), &st) == -1) { - adios(form, "unable to stat format file"); - } - formats = mh_xmalloc((size_t) st.st_size + 1); - if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) { - adios(form, "error reading format file"); - } - formats[st.st_size] = '\0'; - fclose(fp); - - } else if (format) { - formats = getcpy(format); - } else if (def_form) { - if ((fp = fopen(etcpath(def_form), "r")) == NULL) { - adios(def_form, "unable to open format file"); + if (*def_form == '=') { + formats = getcpy(def_form+1); + } else { + if ((fp = fopen(etcpath(def_form), "r")) == NULL) { + adios(def_form, "unable to open format file"); + } + if (fstat(fileno(fp), &st) == -1) { + adios(def_form, "unable to stat format file"); + } + formats = mh_xmalloc((size_t) st.st_size + 1); + if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) { + adios(def_form, "error reading format file"); + } + formats[st.st_size] = '\0'; + fclose(fp); } - if (fstat(fileno(fp), &st) == -1) { - adios(def_form, "unable to stat format file"); - } - formats = mh_xmalloc((size_t) st.st_size + 1); - if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) { - adios(def_form, "error reading format file"); - } - formats[st.st_size] = '\0'; - fclose(fp); - - } else { - formats = getcpy(default_fs); } normalize(formats); /* expand escapes */ diff --git a/uip/ap.c b/uip/ap.c index a4e2189..b49cdc2 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -15,22 +15,20 @@ #define WIDTH 78 #define WBUFSIZ BUFSIZ -#define FORMAT "%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>" +#define FORMAT "=%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>" static struct swit switches[] = { #define FORMSW 0 { "form formatfile", 0 }, -#define FMTSW 1 - { "format string", 5 }, -#define NORMSW 2 +#define NORMSW 1 { "normalize", 0 }, -#define NNORMSW 3 +#define NNORMSW 2 { "nonormalize", 0 }, -#define WIDTHSW 4 +#define WIDTHSW 3 { "width columns", 0 }, -#define VERSIONSW 5 +#define VERSIONSW 4 { "version", 0 }, -#define HELPSW 6 +#define HELPSW 5 { "help", 0 }, { NULL, 0 } }; @@ -55,7 +53,7 @@ main(int argc, char **argv) { int addrp = 0, normalize = AD_HOST; int width = 0, status = 0; - char *cp, *form = NULL, *format = NULL, *nfs; + char *cp, *form = NULL, *nfs; char buf[BUFSIZ], **argp; char **arguments, *addrs[NADDRS]; @@ -91,12 +89,6 @@ main(int argc, char **argv) case FORMSW: if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", argp[-2]); - form = NULL; continue; case WIDTHSW: @@ -124,7 +116,7 @@ main(int argc, char **argv) adios(NULL, "usage: %s [switches] addrs ...", invo_name); /* get new format string */ - nfs = new_fs(form, format, NULL, FORMAT); + nfs = new_fs(form, FORMAT); if (width == 0) { if ((width = sc_width()) < WIDTH / 2) diff --git a/uip/comp.c b/uip/comp.c index 6508ba6..d950833 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -164,7 +164,7 @@ main(int argc, char **argv) close(out); } else { - nfs = new_fs(form, NULL, components, NULL); + nfs = new_fs(form, components); strncpy(drft, m_draft(seq_beyond), sizeof(drft)); if ((out = creat(drft, m_gmprot())) == NOTOK) { adios(drft, "unable to create"); diff --git a/uip/dist.c b/uip/dist.c index 39d6525..4e83a7b 100644 --- a/uip/dist.c +++ b/uip/dist.c @@ -139,7 +139,7 @@ main(int argc, char **argv) if ((out = creat(drft, m_gmprot())) == NOTOK) adios(drft, "unable to create"); - nfs = new_fs(form, NULL, distcomps, NULL); + nfs = new_fs(form, distcomps); if (write(out, nfs, strlen(nfs)) != strlen(nfs)) { adios(drft, "error writing"); } diff --git a/uip/dp.c b/uip/dp.c index a9940d3..66f0f42 100644 --- a/uip/dp.c +++ b/uip/dp.c @@ -15,18 +15,16 @@ #define WIDTH 78 #define WBUFSIZ BUFSIZ -#define FORMAT "%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>" +#define FORMAT "=%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>" static struct swit switches[] = { #define FORMSW 0 { "form formatfile", 0 }, -#define FMTSW 1 - { "format string", 5 }, -#define WIDTHSW 2 +#define WIDTHSW 1 { "width columns", 0 }, -#define VERSIONSW 3 +#define VERSIONSW 2 { "version", 0 }, -#define HELPSW 4 +#define HELPSW 3 { "help", 0 }, { NULL, 0 } }; @@ -50,7 +48,7 @@ int main(int argc, char **argv) { int datep = 0, width = 0, status = 0; - char *cp, *form = NULL, *format = NULL, *nfs; + char *cp, *form = NULL, *nfs; char buf[BUFSIZ], **argp, **arguments; char *dates[NDATES]; @@ -86,13 +84,6 @@ main(int argc, char **argv) if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - form = NULL; continue; case WIDTHSW: @@ -114,7 +105,7 @@ main(int argc, char **argv) adios(NULL, "usage: %s [switches] dates ...", invo_name); /* get new format string */ - nfs = new_fs(form, format, NULL, FORMAT); + nfs = new_fs(form, FORMAT); if (width == 0) { if ((width = sc_width()) < WIDTH / 2) diff --git a/uip/fmtdump.c b/uip/fmtdump.c index 75ac4c2..923a46e 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -14,11 +14,9 @@ static struct swit switches[] = { #define FORMSW 0 { "form formatfile", 0 }, -#define FMTSW 1 - { "format string", 5 }, -#define VERSIONSW 2 +#define VERSIONSW 1 { "version", 0 }, -#define HELPSW 3 +#define HELPSW 2 { "help", 0 }, { NULL, 0 } }; @@ -45,7 +43,7 @@ int main(int argc, char **argv) { int ncomps; - char *cp, *form = NULL, *format = NULL; + char *cp, *form = NULL; char buf[BUFSIZ], *nfs, **argp, **arguments; struct format *fmt; @@ -82,13 +80,6 @@ main(int argc, char **argv) if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - form = NULL; continue; } @@ -102,7 +93,7 @@ main(int argc, char **argv) /* ** Get new format string. Must be before chdir(). */ - nfs = new_fs(form, format, NULL, FORMAT); + nfs = new_fs(form, FORMAT); ncomps = fmt_compile(nfs, &fmt); fmt_dump(fmt); diff --git a/uip/forw.c b/uip/forw.c index 38ede22..b9c3c14 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -237,7 +237,7 @@ main(int argc, char **argv) cpydata(in, out, form, drft); close(in); } else { - nfs = new_fs(form, NULL, forwcomps, NULL); + nfs = new_fs(form, forwcomps); if (write(out, nfs, strlen(nfs)) != strlen(nfs)) { adios(drft, "error writing"); } @@ -306,7 +306,7 @@ build_form(char *form, char *digest, int volume, int issue) char *cp = NULL; /* Get new format string */ - nfs = new_fs(form, NULL, NULL, NULL); + nfs = new_fs(form, NULL); fmtsize = strlen(nfs) + 256; /* Compile format string */ diff --git a/uip/inc.c b/uip/inc.c index 762a858..b48c9ea 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -50,21 +50,19 @@ static struct swit switches[] = { { "file name", 0 }, #define FORMSW 5 { "form formatfile", 0 }, -#define FMTSW 6 - { "format string", 5 }, -#define SILSW 7 +#define SILSW 6 { "silent", 0 }, -#define NSILSW 8 +#define NSILSW 7 { "nosilent", 0 }, -#define TRNCSW 9 +#define TRNCSW 8 { "truncate", 0 }, -#define NTRNCSW 10 +#define NTRNCSW 9 { "notruncate", 0 }, -#define WIDTHSW 11 +#define WIDTHSW 10 { "width columns", 0 }, -#define VERSIONSW 12 +#define VERSIONSW 11 { "version", 0 }, -#define HELPSW 13 +#define HELPSW 12 { "help", 0 }, }; @@ -134,7 +132,7 @@ main(int argc, char **argv) ** not truncate mailspool */ char *cp, *maildir = NULL, *folder = NULL; - char *format = NULL, *form = NULL; + char *form = NULL; char *audfile = NULL, *from = NULL; char buf[BUFSIZ], **argp, *nfs, **arguments; struct msgs *mp = NULL; @@ -240,13 +238,6 @@ main(int argc, char **argv) if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - form = NULL; continue; case WIDTHSW: @@ -373,7 +364,7 @@ main(int argc, char **argv) #endif /* MHE */ /* Get new format string */ - nfs = new_fs(form, format, NULL, FORMAT); + nfs = new_fs(form, FORMAT); if (noisy) { printf("Incorporating new mail into %s...\n\n", folder); diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index 218d38d..5625fa1 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -659,7 +659,9 @@ evalvar(struct mcomp *c1) if (ptos(name, &cp)) return 1; - nfs = new_fs(NULL, NULL, NULL, cp); + cp = concat("=", cp, NULL); + nfs = new_fs(cp, NULL); + free(cp); c1->c_nfs = getcpy(nfs); c1->c_flags |= FORMAT; return 0; @@ -668,7 +670,7 @@ evalvar(struct mcomp *c1) if (!mh_strcasecmp(name, "decode")) { char *nfs; - nfs = new_fs(NULL, NULL, NULL, "%(decode{text})"); + nfs = new_fs("=%(decode{text})", NULL); c1->c_nfs = getcpy(nfs); c1->c_flags |= FORMAT; return 0; diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 9adb5d4..625bb4c 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -171,7 +171,7 @@ rcvdistout(FILE *inb, char *form, char *addrs) adios(drft, "unable to create"); /* get new format string */ - cp = new_fs(form ? form : rcvdistcomps, NULL, NULL, NULL); + cp = new_fs(form ? form : rcvdistcomps, NULL); format_len = strlen(cp); ncomps = fmt_compile(cp, &fmt) + 1; if (!(nxtbuf = compbuffers = diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 99ae680..8166dc9 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -32,7 +32,7 @@ #endif #define SCANFMT \ -"%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\ +"=%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\ %<(mymbox{from})%<{to}To:%14(friendly{to})%>%>%<(zero)%17(friendly{from})%> \ %{subject}" @@ -41,21 +41,19 @@ static struct swit switches[] = { { "biff", 0 }, #define FORMSW 1 { "form formatfile", 0 }, -#define FMTSW 2 - { "format string", 5 }, -#define WIDTHSW 3 +#define WIDTHSW 2 { "width columns", 0 }, -#define NLSW 4 +#define NLSW 3 { "newline", 0 }, -#define NNLSW 5 +#define NNLSW 4 { "nonewline", 0 }, -#define BELSW 6 +#define BELSW 5 { "bell", 0 }, -#define NBELSW 7 +#define NBELSW 6 { "nobell", 0 }, -#define VERSIONSW 8 +#define VERSIONSW 7 { "version", 0 }, -#define HELPSW 9 +#define HELPSW 8 { "help", 0 }, { NULL, 0 } }; @@ -66,7 +64,6 @@ static int newline = 1; static int biff = 0; static int width = 0; static char *form = NULL; -static char *format = NULL; /* ** static prototypes @@ -128,13 +125,6 @@ main(int argc, char **argv) if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - form = NULL; continue; case WIDTHSW: @@ -292,7 +282,7 @@ header_fd(void) rewind(stdin); /* get new format string */ - nfs = new_fs(form, format, NULL, SCANFMT); + nfs = new_fs(form, SCANFMT); scan(stdin, 0, 0, nfs, width, 0, 0, NULL, 0L, 0); if (newline) write(fd, "\n\r", 2); diff --git a/uip/repl.c b/uip/repl.c index 5943857..efc2b54 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -424,7 +424,7 @@ replout(FILE *inb, char *msg, char *drft, struct msgs *mp, umask(mask); /* get new format string */ - cp = new_fs(form, NULL, NULL, NULL); + cp = new_fs(form, NULL); format_len = strlen(cp); /* compile format string */ diff --git a/uip/scan.c b/uip/scan.c index f8e2e11..cfcd3e4 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -20,15 +20,13 @@ static struct swit switches[] = { { "noclear", 0 }, #define FORMSW 2 { "form formatfile", 0 }, -#define FMTSW 3 - { "format string", 5 }, -#define WIDTHSW 4 +#define WIDTHSW 3 { "width columns", 0 }, -#define FILESW 5 +#define FILESW 4 { "file file", 4 }, -#define VERSIONSW 6 +#define VERSIONSW 5 { "version", 0 }, -#define HELPSW 7 +#define HELPSW 6 { "help", 0 }, { NULL, 0 } }; @@ -48,7 +46,7 @@ main(int argc, char **argv) int i, state, msgnum; int seqnum[NUMATTRS], unseen, num_unseen_seq = 0; char *cp, *maildir, *file = NULL, *folder = NULL; - char *form = NULL, *format = NULL, buf[BUFSIZ]; + char *form = NULL, buf[BUFSIZ]; char **argp, *nfs, **arguments; struct msgs_array msgs = { 0, 0, NULL }; struct msgs *mp; @@ -96,13 +94,6 @@ main(int argc, char **argv) if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - form = NULL; continue; case WIDTHSW: @@ -133,7 +124,7 @@ main(int argc, char **argv) /* ** Get new format string. Must be before chdir(). */ - nfs = new_fs(form, format, NULL, FORMAT); + nfs = new_fs(form, FORMAT); /* ** We are scanning a maildrop file -- 1.7.10.4