X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/92128dacf8d5db02379e8f872dc50d31c6aaa55f..5ebb429354533b5aa255283a512dde3a284eec3a:/uip/dp.c diff --git a/uip/dp.c b/uip/dp.c index 82d9963d..2e071973 100644 --- a/uip/dp.c +++ b/uip/dp.c @@ -14,7 +14,6 @@ #define NDATES 100 #define WIDTH 78 -#define WBUFSIZ BUFSIZ #define FORMAT "%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>" @@ -46,7 +45,7 @@ static int process (char *, int); int main (int argc, char **argv) { - int datep = 0, width = 0, status = 0; + int datep = 0, width = -1, status = 0; char *cp, *form = NULL, *format = NULL, *nfs; char buf[BUFSIZ], **argp, **arguments; char *dates[NDATES]; @@ -105,13 +104,16 @@ main (int argc, char **argv) /* get new format string */ nfs = new_fs (form, format, FORMAT); - if (width == 0) { - if ((width = sc_width ()) < WIDTH / 2) + if (width == -1) { + if ((width = sc_width ()) < WIDTH / 2) { + /* Default: width of the terminal, but at least WIDTH/2. */ width = WIDTH / 2; + } else if (width == 0) { + /* Unlimited width. */ + width = INT_MAX; + } width -= 2; } - if (width > WBUFSIZ) - width = WBUFSIZ; fmt_compile (nfs, &fmt, 1); dat[0] = 0;