Removed the -width option from ap and dp. Always print the whole string now.
[mmh] / uip / dp.c
index 66f0f42..fa3a201 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
 
 #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;