9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.11.04.00.41.38; author jromine; state Exp;
19 date 92.02.05.07.26.30; author jromine; state Exp;
24 date 92.01.31.22.09.26; author jromine; state Exp;
29 date 90.04.05.15.01.00; author sources; state Exp;
34 date 90.02.06.13.17.52; author sources; state Exp;
39 date 90.02.06.13.17.41; author sources; state Exp;
53 @/* dp.c - parse dates 822-style */
55 static char ident[] = "@@(#)$Id: dp.c,v 1.6 1992/11/04 00:41:38 jromine Exp jromine $";
59 #include "../h/formatsbr.h"
60 #include "../zotnet/tws.h"
70 #define WBUFSIZ BUFSIZ
72 #define FORMAT "%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>"
76 static struct swit switches[] = {
93 static struct format *fmt;
120 setlocale(LC_ALL, "");
122 invo_name = r1bindex (argv[0], '/');
123 if ((cp = m_find (invo_name)) != NULL) {
124 ap = brkstring (cp = getcpy (cp), " ", "\n");
125 ap = copyip (ap, arguments);
129 (void) copyip (argv + 1, ap);
134 while (cp = *argp++) {
136 switch (smatch (++cp, switches)) {
138 ambigsw (cp, switches);
141 adios (NULLCP, "-%s unknown", cp);
143 (void) sprintf (buf, "%s [switches] dates ...", invo_name);
144 help (buf, switches);
148 if (!(form = *argp++) || *form == '-')
149 adios (NULLCP, "missing argument to %s", argp[-2]);
153 if (!(format = *argp++) || *format == '-')
154 adios (NULLCP, "missing argument to %s", argp[-2]);
159 if (!(cp = *argp++) || *cp == '-')
160 adios (NULLCP, "missing argument to %s", argp[-2]);
165 adios (NULLCP, "more than %d dates", NDATES);
174 adios (NULLCP, "usage: %s [switches] dates ...", invo_name);
176 nfs = new_fs (form, format, FORMAT);
178 if ((width = sc_width ()) < WIDTH / 2)
184 (void) fmt_compile (nfs, &fmt);
185 dat[0] = dat[1] = dat[2] = dat[4] = 0;
188 for (datep = 0; dates[datep]; datep++)
189 status += process (dates[datep], width);
198 static int process (date, length)
203 char buffer[WBUFSIZ + 1];
204 register struct comp *cptr;
206 FINDCOMP (cptr, "text");
208 cptr -> c_text = date;
209 (void) fmtscan (fmt, buffer, length, dat);
210 (void) fputs (buffer, stdout);
224 static char ident[] = "@@(#)$Id: dp.c,v 1.5 1992/02/05 07:26:30 jromine Exp jromine $";
231 @put unseen sequence in mh-format
236 static char ident[] = "@@(#)$Id: dp.c,v 1.4 1992/01/31 22:09:26 jromine Exp jromine $";
249 static char ident[] = "@@(#)$Id: dp.c,v 1.3 1990/04/05 15:01:00 sources Exp jromine $";
255 dat[0] = dat[1] = dat[2] = 0;
266 static char ident[] = "@@(#)$Id:$";