X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fdp.c;h=b9158459be7ab6236bca8bd63fb457b63c569d58;hb=eba408368603a3afe170ef61a334c3a479ea5a29;hp=4e9c5cb8ba78080b0f72f91afb2a3b00d0ba0516;hpb=df6971a59e8d01dcfe605bbac949b7d4b3ab0a92;p=mmh diff --git a/uip/dp.c b/uip/dp.c index 4e9c5cb..b915845 100644 --- a/uip/dp.c +++ b/uip/dp.c @@ -74,10 +74,10 @@ main (int argc, char **argv) snprintf (buf, sizeof(buf), "%s [switches] dates ...", invo_name); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case FORMSW: if (!(form = *argp++) || *form == '-') @@ -117,7 +117,7 @@ main (int argc, char **argv) } if (width > WBUFSIZ) width = WBUFSIZ; - fmt_compile (nfs, &fmt); + fmt_compile (nfs, &fmt, 1); dat[0] = 0; dat[1] = 0; @@ -129,6 +129,7 @@ main (int argc, char **argv) status += process (dates[datep], width); context_save (); /* save the context file */ + fmt_free (fmt, 1); done (status); return 1; } @@ -141,10 +142,13 @@ process (char *date, int length) 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;