]> git.marmaro.de Git - mmh/blobdiff - uip/dp.c
A new test for the POP support in inc. Very simple for now, but it seems
[mmh] / uip / dp.c
index c94c8eac0ccfb33cf48e69b9e15c1e729b39b492..b9158459be7ab6236bca8bd63fb457b63c569d58 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -36,11 +36,6 @@ static struct format *fmt;
 
 static int dat[5];
 
 
 static int dat[5];
 
-/*
- * prototypes
- */
-int sc_width (void);  /* from termsbr.c */
-
 /*
  * static prototypes
  */
 /*
  * static prototypes
  */
@@ -79,10 +74,10 @@ main (int argc, char **argv)
                    snprintf (buf, sizeof(buf), "%s [switches] dates ...",
                        invo_name);
                    print_help (buf, switches, 1);
                    snprintf (buf, sizeof(buf), "%s [switches] dates ...",
                        invo_name);
                    print_help (buf, switches, 1);
-                   done (1);
+                   done (0);
                case VERSIONSW:
                    print_version(invo_name);
                case VERSIONSW:
                    print_version(invo_name);
-                   done (1);
+                   done (0);
 
                case FORMSW: 
                    if (!(form = *argp++) || *form == '-')
 
                case FORMSW: 
                    if (!(form = *argp++) || *form == '-')
@@ -122,7 +117,7 @@ main (int argc, char **argv)
     }
     if (width > WBUFSIZ)
        width = WBUFSIZ;
     }
     if (width > WBUFSIZ)
        width = WBUFSIZ;
-    fmt_compile (nfs, &fmt);
+    fmt_compile (nfs, &fmt, 1);
 
     dat[0] = 0;
     dat[1] = 0;
 
     dat[0] = 0;
     dat[1] = 0;
@@ -134,6 +129,7 @@ main (int argc, char **argv)
        status += process (dates[datep], width);
 
     context_save ();   /* save the context file */
        status += process (dates[datep], width);
 
     context_save ();   /* save the context file */
+    fmt_free (fmt, 1);
     done (status);
     return 1;
 }
     done (status);
     return 1;
 }
@@ -146,10 +142,13 @@ process (char *date, int length)
     char buffer[WBUFSIZ + 1];
     register struct comp *cptr;
 
     char buffer[WBUFSIZ + 1];
     register struct comp *cptr;
 
-    FINDCOMP (cptr, "text");
-    if (cptr)
-       cptr->c_text = date;
-    fmt_scan (fmt, buffer, length, dat);
+    cptr = fmt_findcomp ("text");
+    if (cptr) {
+       if (cptr->c_text)
+           free(cptr->c_text);
+       cptr->c_text = getcpy(date);
+    }
+    fmt_scan (fmt, buffer, sizeof buffer - 1, length, dat);
     fputs (buffer, stdout);
 
     return status;
     fputs (buffer, stdout);
 
     return status;