X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/92128dacf8d5db02379e8f872dc50d31c6aaa55f..337b4e616e8f53ba06285b1645e1df9918ed5c16:/uip/ap.c?ds=sidebyside diff --git a/uip/ap.c b/uip/ap.c index 1148871d..3dd77b17 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -15,7 +15,6 @@ #define NADDRS 100 #define WIDTH 78 -#define WBUFSIZ BUFSIZ #define FORMAT "%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>" @@ -48,7 +47,7 @@ int main (int argc, char **argv) { int addrp = 0; - int width = 0, status = 0; + int width = -1, status = 0; char *cp, *form = NULL, *format = NULL, *nfs; char buf[BUFSIZ], **argp; char **arguments, *addrs[NADDRS]; @@ -109,13 +108,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;