From 0073224c28bf81dad1812d406bb9915b24b23eb6 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sat, 11 Feb 2012 11:53:04 +0100 Subject: [PATCH] Removed the -width option from ap and dp. Always print the whole string now. --- man/ap.man8 | 3 --- man/dp.man8 | 3 --- man/mh-chart.man1 | 4 ---- uip/Makefile.in | 8 ++++---- uip/ap.c | 41 +++++++++-------------------------------- uip/dp.c | 41 +++++++++-------------------------------- 6 files changed, 22 insertions(+), 78 deletions(-) diff --git a/man/ap.man8 b/man/ap.man8 index b0ae615..699e993 100644 --- a/man/ap.man8 +++ b/man/ap.man8 @@ -11,8 +11,6 @@ ap \- parse addresses 822-style .RB [ \-form .IR formatfile ] .RB [ \-normalize " | " \-nonormalize ] -.RB [ \-width -.IR columns ] .RB [ \-version ] .RB [ \-help ] .I addrs @@ -98,7 +96,6 @@ dp(8), .nf .RB ` \-form "' defaults as described above" .RB ` \-normalize ' -.RB ` \-width "' defaults to the width of the terminal" .fi .SH CONTEXT diff --git a/man/dp.man8 b/man/dp.man8 index d07fa6b..eead007 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 [ \-width -.IR columns ] .RB [ \-version ] .RB [ \-help ] .I dates @@ -80,7 +78,6 @@ ap(8), .SH DEFAULTS .nf .RB ` \-form "' default as described above" -.RB ` \-width "' default to the width of the terminal" .fi .SH CONTEXT diff --git a/man/mh-chart.man1 b/man/mh-chart.man1 index ada5916..d793989 100644 --- a/man/mh-chart.man1 +++ b/man/mh-chart.man1 @@ -34,8 +34,6 @@ mh-chart \- Chart of nmh Commands .RB [ \-form .IR formatfile ] .RB [ \-normalize " | " \-nonormalize ] -.RB [ \-width -.IR columns ] .RB [ \-version ] .RB [ \-help ] .I addrs @@ -98,8 +96,6 @@ mh-chart \- Chart of nmh Commands .B %libdir%/dp .RB [ \-form .IR formatfile ] -.RB [ \-width -.IR columns ] .RB [ \-version ] .RB [ \-help ] .I dates diff --git a/uip/Makefile.in b/uip/Makefile.in index 48b8524..8d16759 100644 --- a/uip/Makefile.in +++ b/uip/Makefile.in @@ -92,8 +92,8 @@ all: $(CMDS) $(MISC) $(SCMDS) ali: ali.o aliasbr.o $(LOCALLIBS) $(LINK) ali.o aliasbr.o $(LINKLIBS) -ap: ap.o termsbr.o $(LOCALLIBS) - $(LINK) ap.o termsbr.o $(LINKLIBS) $(TERMLIB) +ap: ap.o $(LOCALLIBS) + $(LINK) ap.o $(LINKLIBS) anno: anno.o annosbr.o $(LOCALLIBS) $(LINK) anno.o annosbr.o $(LINKLIBS) @@ -110,8 +110,8 @@ conflict: conflict.o aliasbr.o $(LOCALLIBS) dist: dist.o whatnowproc.o $(LOCALLIBS) $(LINK) dist.o whatnowproc.o $(LINKLIBS) -dp: dp.o termsbr.o $(LOCALLIBS) - $(LINK) dp.o termsbr.o $(LINKLIBS) $(TERMLIB) +dp: dp.o $(LOCALLIBS) + $(LINK) dp.o $(LINKLIBS) flist: flist.o $(LOCALLIBS) $(LINK) flist.o $(LINKLIBS) diff --git a/uip/ap.c b/uip/ap.c index b49cdc2..aaa8762 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -12,9 +12,6 @@ #define NADDRS 100 -#define WIDTH 78 -#define WBUFSIZ BUFSIZ - #define FORMAT "=%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>" static struct swit switches[] = { @@ -24,11 +21,9 @@ static struct swit switches[] = { { "normalize", 0 }, #define NNORMSW 2 { "nonormalize", 0 }, -#define WIDTHSW 3 - { "width columns", 0 }, -#define VERSIONSW 4 +#define VERSIONSW 3 { "version", 0 }, -#define HELPSW 5 +#define HELPSW 4 { "help", 0 }, { NULL, 0 } }; @@ -38,21 +33,16 @@ static struct format *fmt; static int dat[5]; /* -** prototypes -*/ -int sc_width(void); /* from termsbr.c */ - -/* ** static prototypes */ -static int process(char *, int, int); +static int process(char *, int); int main(int argc, char **argv) { int addrp = 0, normalize = AD_HOST; - int width = 0, status = 0; + int status = 0; char *cp, *form = NULL, *nfs; char buf[BUFSIZ], **argp; char **arguments, *addrs[NADDRS]; @@ -91,12 +81,6 @@ main(int argc, char **argv) adios(NULL, "missing argument to %s", argp[-2]); continue; - case WIDTHSW: - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", argp[-2]); - width = atoi(cp); - continue; - case NORMSW: normalize = AD_HOST; continue; @@ -118,24 +102,17 @@ main(int argc, char **argv) /* get new format string */ nfs = new_fs(form, FORMAT); - if (width == 0) { - if ((width = sc_width()) < WIDTH / 2) - width = WIDTH / 2; - width -= 2; - } - if (width > WBUFSIZ) - width = WBUFSIZ; fmt_norm = normalize; fmt_compile(nfs, &fmt); dat[0] = 0; dat[1] = 0; dat[2] = 0; - dat[3] = width; + dat[3] = BUFSIZ; dat[4] = 0; for (addrp = 0; addrs[addrp]; addrp++) - status += process(addrs[addrp], width, normalize); + status += process(addrs[addrp], normalize); done(status); return 1; @@ -149,11 +126,11 @@ struct pqpair { static int -process(char *arg, int length, int norm) +process(char *arg, int norm) { int status = 0; register char *cp; - char buffer[WBUFSIZ + 1], error[BUFSIZ]; + char buffer[BUFSIZ + 1], error[BUFSIZ]; register struct comp *cptr; register struct pqpair *p, *q; struct pqpair pq; @@ -183,7 +160,7 @@ process(char *arg, int length, int norm) if (cptr) cptr->c_text = p->pq_error; - fmt_scan(fmt, buffer, length, dat); + fmt_scan(fmt, buffer, BUFSIZ, dat); fputs(buffer, stdout); free(p->pq_text); diff --git a/uip/dp.c b/uip/dp.c index 66f0f42..fa3a201 100644 --- a/uip/dp.c +++ b/uip/dp.c @@ -12,19 +12,14 @@ #define NDATES 100 -#define WIDTH 78 -#define WBUFSIZ BUFSIZ - #define FORMAT "=%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>" static struct swit switches[] = { #define FORMSW 0 { "form formatfile", 0 }, -#define WIDTHSW 1 - { "width columns", 0 }, -#define VERSIONSW 2 +#define VERSIONSW 1 { "version", 0 }, -#define HELPSW 3 +#define HELPSW 2 { "help", 0 }, { NULL, 0 } }; @@ -34,20 +29,15 @@ static struct format *fmt; static int dat[5]; /* -** prototypes -*/ -int sc_width(void); /* from termsbr.c */ - -/* ** static prototypes */ -static int process(char *, int); +static int process(char *); int main(int argc, char **argv) { - int datep = 0, width = 0, status = 0; + int datep = 0, status = 0; char *cp, *form = NULL, *nfs; char buf[BUFSIZ], **argp, **arguments; char *dates[NDATES]; @@ -86,12 +76,6 @@ main(int argc, char **argv) argp[-2]); continue; - case WIDTHSW: - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - width = atoi(cp); - continue; } } if (datep > NDATES) @@ -107,23 +91,16 @@ main(int argc, char **argv) /* get new format string */ nfs = new_fs(form, FORMAT); - if (width == 0) { - if ((width = sc_width()) < WIDTH / 2) - width = WIDTH / 2; - width -= 2; - } - if (width > WBUFSIZ) - width = WBUFSIZ; fmt_compile(nfs, &fmt); dat[0] = 0; dat[1] = 0; dat[2] = 0; - dat[3] = width; + dat[3] = BUFSIZ; dat[4] = 0; for (datep = 0; dates[datep]; datep++) - status += process(dates[datep], width); + status += process(dates[datep]); context_save(); /* save the context file */ done(status); @@ -132,16 +109,16 @@ main(int argc, char **argv) static int -process(char *date, int length) +process(char *date) { int status = 0; - char buffer[WBUFSIZ + 1]; + char buffer[BUFSIZ + 1]; register struct comp *cptr; FINDCOMP(cptr, "text"); if (cptr) cptr->c_text = date; - fmt_scan(fmt, buffer, length, dat); + fmt_scan(fmt, buffer, BUFSIZ, dat); fputs(buffer, stdout); return status; -- 1.7.10.4