]> diplodocus.org Git - nmh/blobdiff - uip/dp.c
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / uip / dp.c
index 2e07197303ad4ef3f30d1f35cf3a63c6cb502346..6909239bb14341b245b6b8306bc33ae104881b1e 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -50,7 +50,7 @@ main (int argc, char **argv)
     char buf[BUFSIZ], **argp, **arguments;
     char *dates[NDATES];
 
-    if (nmh_init(argv[0], 1)) { return 1; }
+    if (nmh_init(argv[0], 2)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -108,11 +108,11 @@ main (int argc, char **argv)
        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;
+    } else if (width == 0) {
+       /* Unlimited width.  */
+       width = INT_MAX;
     }
     fmt_compile (nfs, &fmt, 1);
 
@@ -136,8 +136,9 @@ static int
 process (char *date, int length)
 {
     int status = 0;
-    charstring_t scanl = charstring_create (length);
-    register struct comp *cptr;
+    charstring_t scanl =
+       charstring_create (length < NMH_BUFSIZ ? length : NMH_BUFSIZ);
+    struct comp *cptr;
 
     cptr = fmt_findcomp ("text");
     if (cptr) {