2 ** mhl.c -- the nmh message listing program
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
10 #include <h/signals.h>
11 #include <h/addrsbr.h>
12 #include <h/fmt_scan.h>
23 ** for a component containing addresses, ADDRFMT, if COMPRESS is also
24 ** set, then addresses get split wrong (not at the spaces between commas).
25 ** To fix this correctly, putstr() should know about "atomic" strings that
26 ** must NOT be broken across lines. That's too difficult for right now
27 ** (it turns out that there are a number of degernate cases), so in
28 ** oneline(), instead of
30 ** (*onelp == '\n' && !onelp[1])
32 ** being a terminating condition,
34 ** (*onelp == '\n' && (!onelp[1] || (flags & ADDRFMT)))
36 ** is used instead. This cuts the line prematurely, and gives us a much
37 ** better chance of getting things right.
46 static struct swit switches[] = {
48 { "form formfile", 0 },
50 { "width columns", 0 },
64 char *version=VERSION;
66 #define NOCOMPONENT 0x000001 /* don't show component name */
67 #define UPPERCASE 0x000002 /* display in all upper case */
68 #define CENTER 0x000004 /* center line */
69 #define CLEARTEXT 0x000008 /* cleartext */
70 #define EXTRA 0x000010 /* an "extra" component */
71 #define HDROUTPUT 0x000020 /* already output */
72 #define LEFTADJUST 0x000040 /* left justify multiple lines */
73 #define COMPRESS 0x000080 /* compress text */
74 #define ADDRFMT 0x000100 /* contains addresses */
75 #define DATEFMT 0x000200 /* contains dates */
76 #define FORMAT 0x000400 /* parse address/date/RFC-2047 field */
77 #define INIT 0x000800 /* initialize component */
78 #define SPLIT 0x001000 /* split headers (don't concatenate) */
79 #define NONEWLINE 0x002000 /* don't write trailing newline */
80 #define RTRIM 0x004000 /* trim trailing whitespace */
81 #define LBITS "\020\01NOCOMPONENT\02UPPERCASE\03CENTER\04CLEARTEXT\05EXTRA\06HDROUTPUT\07LEFTADJUST\010COMPRESS\011ADDRFMT\012DATEFMT\013FORMAT\014INIT\015SPLIT\016NONEWLINE\017RTRIM"
82 #define GFLAGS (NOCOMPONENT | UPPERCASE | CENTER | LEFTADJUST | COMPRESS | SPLIT)
85 char *c_name; /* component name */
86 char *c_text; /* component text */
87 char *c_ovtxt; /* text overflow indicator */
88 char *c_fstr; /* iff FORMAT */
89 struct format *c_fmt; /* .. */
90 int c_offset; /* left margin indentation */
91 int c_ovoff; /* overflow indentation */
92 int c_width; /* width of field */
93 int c_cwidth; /* width of component */
98 static struct mcomp *msghd = NULL;
99 static struct mcomp *msgtl = NULL;
100 static struct mcomp *fmthd = NULL;
101 static struct mcomp *fmttl = NULL;
103 static struct mcomp global = {
104 NULL, NULL, NULL, NULL, NULL, 0, -1, 80, -1, 0, NULL
107 static struct mcomp holder = {
108 NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NOCOMPONENT, NULL
116 static struct pair pairs[] = {
119 { "Sender", ADDRFMT },
120 { "Reply-To", ADDRFMT },
124 { "Resent-Date", DATEFMT },
125 { "Resent-From", ADDRFMT },
126 { "Resent-Sender", ADDRFMT },
127 { "Resent-Reply-To", ADDRFMT },
128 { "Resent-To", ADDRFMT },
129 { "Resent-Cc", ADDRFMT },
130 { "Resent-Bcc", ADDRFMT },
140 static struct triple triples[] = {
141 { "nocomponent", NOCOMPONENT, 0 },
142 { "uppercase", UPPERCASE, 0 },
143 { "nouppercase", 0, UPPERCASE },
144 { "center", CENTER, 0 },
145 { "nocenter", 0, CENTER },
146 { "leftadjust", LEFTADJUST, 0 },
147 { "noleftadjust", 0, LEFTADJUST },
148 { "compress", COMPRESS, 0 },
149 { "nocompress", 0, COMPRESS },
150 { "split", SPLIT, 0 },
151 { "nosplit", 0, SPLIT },
152 { "rtrim", RTRIM, 0 },
153 { "nortrim", 0, RTRIM },
154 { "addrfield", ADDRFMT, DATEFMT },
155 { "datefield", DATEFMT, ADDRFMT },
156 { "newline", 0, NONEWLINE },
157 { "nonewline", NONEWLINE, 0 },
162 static int dobody = 1;
163 static int forwflg = 0;
164 static int forwall = 0;
166 static int exitstat = 0;
167 static int mhldebug = 0;
169 static unsigned int column;
174 static unsigned int wid;
178 static unsigned char *onelp;
182 static int num_ignores = 0;
183 static char *ignores[MAXARGS];
185 volatile sig_atomic_t eflag = 0;
188 ** Redefine a couple of functions.
189 ** These are undefined later in the code.
195 static void mhl_format(char *, int);
196 static int evalvar(struct mcomp *);
197 static int ptoi(char *, int *);
198 static int ptos(char *, char **);
199 static char *parse(void);
200 static void process(char *, int, int);
201 static void mhlfile(FILE *, char *, int, int);
202 static int mcomp_flags(char *);
203 static char *mcomp_add(long, char *, char *);
204 static void mcomp_format(struct mcomp *, struct mcomp *);
205 static struct mcomp *add_queue(struct mcomp **, struct mcomp **,
206 char *, char *, int);
207 static void free_queue(struct mcomp **, struct mcomp **);
208 static void putcomp(struct mcomp *, struct mcomp *, int);
209 static char *oneline(char *, long);
210 static void putstr(char *);
211 static void putch(char);
212 static void intrser(int);
214 int sc_width(void); /* from termsbr.c */
218 main(int argc, char **argv)
220 int i, width = 0, vecp = 0;
221 char *cp, *form = NULL;
222 char buf[BUFSIZ], *files[MAXARGS];
223 char **argp, **arguments;
225 setlocale(LC_ALL, "");
226 invo_name = mhbasename(argv[0]);
228 /* read user profile/context */
231 arguments = getarguments(invo_name, argc, argv, 1);
234 if ((cp = getenv("MHLDEBUG")) && *cp)
237 while ((cp = *argp++)) {
239 switch (smatch(++cp, switches)) {
241 ambigsw(cp, switches);
244 adios(EX_USAGE, NULL, "-%s unknown\n", cp);
247 snprintf(buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
248 print_help(buf, switches, 1);
249 exit(argc == 2 ? EX_OK : EX_USAGE);
251 print_version(invo_name);
252 exit(argc == 2 ? EX_OK : EX_USAGE);
255 if (!(form = *argp++) || *form == '-')
256 adios(EX_USAGE, NULL, "missing argument to %s",
261 if (!(cp = *argp++) || *cp == '-')
262 adios(EX_USAGE, NULL, "missing argument to %s",
264 if ((width = atoi(cp)) < 1)
265 adios(EX_USAGE, NULL, "bad argument %s %s",
270 forwall++; /* fall */
283 mhl_format(form ? form : mhlformat, width);
286 process(NULL, 1, vecp = 1);
288 for (i = 0; i < vecp; i++)
289 process(files[i], i + 1, vecp);
293 printf("\n------- End of Forwarded Message%s\n\n",
294 vecp > 1 ? "s" : "");
298 if (ferror(stdout)) {
299 adios(EX_IOERR, "output", "error writing");
307 mhl_format(char *file, int width)
311 char *ap, buffer[BUFSIZ], name[NAMESZ];
315 static dev_t dev = 0;
316 static ino_t ino = 0;
317 static time_t mtime = 0;
320 if (stat(etcpath(file), &st) != NOTOK
321 && mtime == st.st_mtime
326 free_queue(&fmthd, &fmttl);
329 if ((fp = fopen(etcpath(file), "r")) == NULL)
330 adios(EX_IOERR, file, "unable to open format file");
332 if (fstat(fileno(fp), &st) != NOTOK) {
338 global.c_ovtxt = global.c_fstr = NULL;
342 if ((i = sc_width()) > 5)
344 global.c_cwidth = -1;
348 while (vfgets(fp, &ap) == OK) {
353 if ((cp = strchr(bp, '\n')))
357 c1 = add_queue(&fmthd, &fmttl, NULL, bp + 1,
363 strncpy(name, parse(), sizeof(name));
369 ** Split this list of fields to ignore, and copy
370 ** it to the end of the current "ignores" list.
372 if (!mh_strcasecmp(name, "ignores")) {
376 /* split the fields */
377 tmparray = brkstring(mh_xstrdup(++parptr), ",",
380 ** copy pointers to split fields
383 while (tmparray[n] && num_ignores<MAXARGS-1) {
384 ignores[num_ignores++] = tmparray[n++];
386 ignores[num_ignores] = NULL;
391 if (evalvar(&global))
392 adios(EX_CONFIG, NULL, "format file syntax error: %s", bp);
399 c1 = add_queue(&fmthd, &fmttl, name, NULL, INIT);
400 while (*parptr == ':' || *parptr == ',') {
403 adios(EX_CONFIG, NULL, "format file syntax error: %s", bp);
405 if (!c1->c_fstr && global.c_fstr) {
406 if ((c1->c_flags & DATEFMT) &&
407 (global.c_flags & DATEFMT)) {
408 c1->c_fstr = mh_xstrdup(global.c_fstr);
409 } else if ((c1->c_flags & ADDRFMT) &&
410 (global.c_flags & ADDRFMT)) {
411 c1->c_fstr = mh_xstrdup(global.c_fstr);
417 adios(EX_CONFIG, NULL, "format file syntax error: %s", bp);
423 for (c1 = fmthd; c1; c1 = c1->c_next) {
424 fprintf(stderr, "c1: name=\"%s\" text=\"%s\" ovtxt=\"%s\"\n", c1->c_name, c1->c_text, c1->c_ovtxt);
425 fprintf(stderr, "\tfstr=0x%x fmt=0x%x\n", (unsigned int)(unsigned long) c1->c_fstr, (unsigned int)(unsigned long) c1->c_fmt);
426 fprintf(stderr, "\toffset=%d ovoff=%d width=%d cwidth=%d\n", c1->c_offset, c1->c_ovoff, c1->c_width, c1->c_cwidth);
427 fprintf (stderr, "\tflags=%s\n", snprintb(buffer, sizeof(buffer), (unsigned) c1->c_flags, LBITS));
433 global.c_width = width;
434 if (global.c_width < 5)
435 global.c_width = 10000;
440 evalvar(struct mcomp *c1)
442 char *cp, name[NAMESZ];
447 strncpy(name, parse(), sizeof(name));
449 if (!mh_strcasecmp(name, "component")) {
450 if (ptos(name, &c1->c_text))
452 c1->c_flags &= ~NOCOMPONENT;
456 if (!mh_strcasecmp(name, "overflowtext"))
457 return ptos(name, &c1->c_ovtxt);
459 if (!mh_strcasecmp(name, "formatfield")) {
464 cp = concat("=", cp, NULL);
465 fmtstr = new_fs(cp, NULL);
467 c1->c_fstr = mh_xstrdup(fmtstr);
468 c1->c_flags |= FORMAT;
472 if (!mh_strcasecmp(name, "decode")) {
475 fmtstr = new_fs("=%(decode{text})", NULL);
476 c1->c_fstr = mh_xstrdup(fmtstr);
477 c1->c_flags |= FORMAT;
481 if (!mh_strcasecmp(name, "offset"))
482 return ptoi(name, &c1->c_offset);
483 if (!mh_strcasecmp(name, "overflowoffset"))
484 return ptoi(name, &c1->c_ovoff);
485 if (!mh_strcasecmp(name, "width"))
486 return ptoi(name, &c1->c_width);
487 if (!mh_strcasecmp(name, "compwidth"))
488 return ptoi(name, &c1->c_cwidth);
490 for (ap = triples; ap->t_name; ap++)
491 if (!mh_strcasecmp(ap->t_name, name)) {
492 c1->c_flags |= ap->t_on;
493 c1->c_flags &= ~ap->t_off;
502 ptoi(char *name, int *i)
506 if (*parptr++ != '=' || !*(cp = parse())) {
507 advise(NULL, "missing argument to variable %s", name);
517 ptos(char *name, char **s)
521 if (*parptr++ != '=') {
522 advise(NULL, "missing argument to variable %s", name);
526 if (*parptr != '"') {
527 for (cp = parptr; *parptr && *parptr != ':' && *parptr != ',';
531 for (cp = ++parptr; *parptr && *parptr != '"'; parptr++)
532 if (*parptr == QUOTE)
539 if ((*parptr = c) == '"')
550 static char result[NAMESZ];
552 for (cp = result; *parptr && (cp - result < NAMESZ); parptr++) {
571 process(char *fname, int ofilen, int ofilec)
577 fp = fopen(fname, "r");
579 advise(fname, "unable to open");
587 SIGNAL(SIGINT, intrser);
588 mhlfile(fp, fname, ofilen, ofilec);
590 SIGNAL(SIGINT, SIG_IGN);
594 mh_free0(&(holder.c_text));
596 free_queue(&msghd, &msgtl);
597 for (c1 = fmthd; c1; c1 = c1->c_next)
598 c1->c_flags &= ~HDROUTPUT;
602 simplematch(char *pattern, char *b)
604 char *match = strrchr(pattern, '*');
608 /* check if pattern ends with a * and is not escaped witch a \ */
609 if (!match || match[1] || (match > pattern && match[-1] == '\\')) {
610 if (!match || match[1]) {
611 return mh_strcasecmp(pattern, b) == 0;
615 ret = mh_strcasecmp(pattern, b)==0;
621 repl = b[match-pattern];
622 b[match-pattern] = '\0';
624 ret = (mh_strcasecmp(pattern, b) == 0);
625 b[match-pattern] = repl;
631 mhlfile(FILE *fp, char *mname, int ofilen, int ofilec)
634 struct field f = {{0}};
635 struct mcomp *c1, *c2, *c3;
641 printf(" Forwarded Message%s", ofilec > 1 ? "s" : "");
643 printf(" Message %d", ofilen);
646 } else if (ofilec > 1) {
650 printf(">>> %s\n\n", mname);
653 for (state = FLD2; !eflag; ) {
654 switch (state = m_getfld2(state, &f, fp)) {
656 for (ip = ignores; *ip; ip++)
657 if (simplematch(*ip, f.name)) {
664 for (c2 = fmthd; c2; c2 = c2->c_next)
665 if (mh_strcasecmp(c2->c_name, f.name)==0) {
669 if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
670 for (c1 = msghd; c1; c1 = c1->c_next)
671 if (mh_strcasecmp(c1->c_name,
673 c1->c_text = mcomp_add(c1->c_flags, f.value, c1->c_text);
677 c1 = add_queue(&msghd, &msgtl, f.name, f.value, 0);
680 c1->c_flags |= EXTRA;
687 for (c1 = fmthd; c1; c1 = c1->c_next) {
688 if (c1->c_flags & CLEARTEXT) {
689 putcomp(c1, c1, ONECOMP);
692 if (mh_strcasecmp(c1->c_name, "messagename")==0) {
693 holder.c_text = concat("(Message ",
695 putcomp(c1, &holder, ONECOMP);
696 mh_free0(&(holder.c_text));
699 if (mh_strcasecmp(c1->c_name, "extras")==0) {
700 for (c2 = msghd; c2; c2 = c2->c_next) {
701 if (c2->c_flags & EXTRA) {
702 putcomp(c1, c2, TWOCOMP);
707 if (dobody && mh_strcasecmp(c1->c_name, "body")==0) {
708 holder.c_text = mh_xstrdup(f.value);
709 while (state == BODY2) {
710 putcomp(c1, &holder, BODYCOMP);
711 state = m_getfld2(state, &f, fp);
713 holder.c_text = mh_xstrdup(f.value);
715 mh_free0(&(holder.c_text));
718 for (c2 = msghd; c2; c2 = c2->c_next) {
719 if (mh_strcasecmp(c2->c_name,
721 putcomp(c1, c2, ONECOMP);
722 if (!(c1->c_flags & SPLIT)) {
733 advise(NULL, "format error in message %s", mname);
738 adios(EX_SOFTWARE, NULL, "getfld() returned %d", state);
745 mcomp_flags(char *name)
749 for (ap = pairs; ap->p_name; ap++)
750 if (!mh_strcasecmp(ap->p_name, name))
751 return (ap->p_flags);
758 mcomp_add(long flags, char *s1, char *s2)
762 if (!(flags & ADDRFMT))
765 if (s2 && *(dp = s2 + strlen(s2) - 1) == '\n')
768 return add(s1, add(",\n", s2));
775 struct pqpair *pq_next;
780 mcomp_format(struct mcomp *c1, struct mcomp *c2)
784 char buffer[BUFSIZ], error[BUFSIZ];
786 struct pqpair *p, *q;
795 dat[3] = sizeof(buffer) - 1;
797 fmt_compile(c1->c_fstr, &c1->c_fmt);
799 if (!(c1->c_flags & ADDRFMT)) {
800 FINDCOMP(cptr, "text");
803 if ((cp = strrchr(ap, '\n'))) /* drop ending newline */
807 fmt_scan(c1->c_fmt, buffer, sizeof(buffer) - 1, dat);
808 /* Don't need to append a newline, dctime() already did */
809 c2->c_text = mh_xstrdup(buffer);
815 (q = &pq)->pq_next = NULL;
816 while ((cp = getname(ap))) {
817 p = mh_xcalloc(1, sizeof(*p));
819 if ((mp = getm(cp, NULL, 0, AD_NAME, error)) == NULL) {
820 p->pq_text = mh_xstrdup(cp);
821 p->pq_error = mh_xstrdup(error);
823 p->pq_text = mh_xstrdup(mp->m_text);
826 q = (q->pq_next = p);
829 for (p = pq.pq_next; p; p = q) {
830 FINDCOMP(cptr, "text");
832 cptr->c_text = p->pq_text;
833 FINDCOMP(cptr, "error");
835 cptr->c_text = p->pq_error;
837 fmt_scan(c1->c_fmt, buffer, sizeof(buffer) - 1, dat);
840 c2->c_text = add(",\n", c2->c_text);
841 if (*(cp = buffer + strlen(buffer) - 1) == '\n')
843 c2->c_text = add(buffer, c2->c_text);
846 mh_free0(&(p->pq_text));
848 mh_free0(&(p->pq_error));
853 c2->c_text = add("\n", c2->c_text);
858 static struct mcomp *
859 add_queue(struct mcomp **head, struct mcomp **tail, char *name,
860 char *text, int flags)
864 c1 = mh_xcalloc(1, sizeof(*c1));
866 c1->c_flags = flags & ~INIT;
867 if ((c1->c_name = name ? mh_xstrdup(name) : NULL))
868 c1->c_flags |= mcomp_flags(c1->c_name);
869 c1->c_text = text ? mh_xstrdup(text) : NULL;
872 c1->c_ovtxt = mh_xstrdup(global.c_ovtxt);
873 c1->c_offset = global.c_offset;
874 c1->c_ovoff = global. c_ovoff;
876 c1->c_cwidth = global.c_cwidth;
877 c1->c_flags |= global.c_flags & GFLAGS;
882 (*tail)->c_next = c1;
890 free_queue(struct mcomp **head, struct mcomp **tail)
892 struct mcomp *c1, *c2;
894 for (c1 = *head; c1; c1 = c2) {
897 mh_free0(&(c1->c_name));
899 mh_free0(&(c1->c_text));
901 mh_free0(&(c1->c_ovtxt));
903 mh_free0(&(c1->c_fstr));
905 mh_free0(&(c1->c_fmt));
909 *head = *tail = NULL;
914 putcomp(struct mcomp *c1, struct mcomp *c2, int flag)
918 char trimmed_prefix[BUFSIZ];
920 strncpy(trimmed_prefix, c1->c_text ? c1->c_text : c1->c_name, sizeof(trimmed_prefix) - 1);
921 rtrim(trimmed_prefix);
924 wid = c1->c_width ? c1->c_width : global.c_width;
925 ovoff = (c1->c_ovoff >= 0 ? c1->c_ovoff : global.c_ovoff)
927 if ((ovtxt = c1->c_ovtxt ? c1->c_ovtxt : global.c_ovtxt) == NULL)
929 if (wid < ovoff + strlen(ovtxt) + 5)
930 adios(EX_SOFTWARE, NULL, "component: %s width(%d) too small for overflow(%d)", c1->c_name, wid, ovoff + strlen(ovtxt) + 5);
933 if (c1->c_flags & CLEARTEXT) {
934 putstr((c1->c_flags & RTRIM) ? rtrim(c1->c_text) : c1->c_text);
939 if (c1->c_fstr && (c1->c_flags & (ADDRFMT | DATEFMT | FORMAT)))
940 mcomp_format(c1, c2);
942 if (c1->c_flags & CENTER) {
943 count = (c1->c_width ? c1->c_width : global.c_width)
944 - c1->c_offset - strlen(c2->c_text);
945 if (!(c1->c_flags & HDROUTPUT) && !(c1->c_flags & NOCOMPONENT))
946 count -= strlen(c1->c_text ? c1->c_text : c1->c_name)
948 lm = c1->c_offset + (count / 2);
954 if (!(c1->c_flags & HDROUTPUT) && !(c1->c_flags & NOCOMPONENT)) {
955 if (c1->c_flags & UPPERCASE) /* uppercase component also */
956 for (cp = (c1->c_text ? c1->c_text : c1->c_name); *cp; cp++)
959 if (*c2->c_text && *c2->c_text != '\n' && *c2->c_text != '\r') {
960 putstr(c1->c_text ? c1->c_text : c1->c_name);
962 putstr(trimmed_prefix);
964 if (flag != BODYCOMP) {
966 if (!(c1->c_flags & SPLIT))
967 c1->c_flags |= HDROUTPUT;
970 if ((count = c1->c_cwidth -
971 strlen(c1->c_text ? c1->c_text : c1->c_name) - 2) > 0)
975 c1->c_flags |= HDROUTPUT; /* for BODYCOMP */
978 if (flag == TWOCOMP && !(c2->c_flags & HDROUTPUT)
979 && !(c2->c_flags & NOCOMPONENT)) {
980 if (c1->c_flags & UPPERCASE)
981 for (cp = c2->c_name; *cp; cp++)
986 if (!(c1->c_flags & SPLIT))
987 c2->c_flags |= HDROUTPUT;
990 if ((count = c1->c_cwidth - strlen(c2->c_name) - 2) > 0)
994 if (c1->c_flags & UPPERCASE)
995 for (cp = c2->c_text; *cp; cp++)
1001 if (flag == TWOCOMP)
1002 count = (c1->c_cwidth >= 0) ? c1->c_cwidth :
1003 (int)strlen(c2->c_name) + 2;
1005 count = (c1->c_cwidth >= 0) ? (size_t)c1->c_cwidth :
1007 c1->c_text : c1->c_name) + 2;
1009 count += c1->c_offset;
1011 if ((cp = oneline(c2->c_text, c1->c_flags))) {
1012 putstr((c1->c_flags & RTRIM) ? rtrim(cp) : cp);
1016 while ((cp = oneline(c2->c_text, c1->c_flags))) {
1018 if (flag == BODYCOMP && !(c1->c_flags & NOCOMPONENT)) {
1020 putstr(c1->c_text ? c1->c_text : c1->c_name);
1022 putstr(trimmed_prefix);
1026 putstr((c1->c_flags & RTRIM) ? rtrim(cp) : cp);
1031 if (flag == BODYCOMP && term == '\n')
1032 c1->c_flags &= ~HDROUTPUT; /* Buffer ended on a newline */
1037 oneline(char *stuff, long flags)
1045 return (onelp = NULL);
1049 if (flags & COMPRESS) {
1050 for (spc = 1, cp = ret; *onelp; onelp++)
1051 if (isspace(*onelp)) {
1052 if (*onelp == '\n' &&
1054 (flags & ADDRFMT))) {
1069 while (*onelp && *onelp != '\n')
1071 if (*onelp == '\n') {
1075 if (flags & LEFTADJUST)
1076 while (*ret == ' ' || *ret == '\t')
1079 if (*onelp == 0 && term == '\n' && (flags & NONEWLINE))
1087 putstr(char *string)
1089 if (!column && lm > 0) {
1125 ** If we are forwarding this message, and the first
1126 ** column contains a dash, then add a dash and a space.
1128 if (column == 0 && forwflg && ch == '-') {
1137 if (column >= wid) {
1141 putstr(ovtxt ? ovtxt : "");