ezmlmx 0.68
ezmlmx
Loading...
Searching...
No Matches
dateline.c
Go to the documentation of this file.
1#include "fmt.h"
2#include "date2yyyymm.h"
3#include "stralloc.h"
4#include "cgi.h"
5
11
12static char strnum[FMT_ULONG];
13
19
20int dateline(stralloc *dt,unsigned long d)
21{
22 const char *mo;
23
24 switch (d%100) {
25 case 1: mo = "January"; break;
26 case 2: mo = "February"; break;
27 case 3: mo = "March"; break;
28 case 4: mo = "April"; break;
29 case 5: mo = "May"; break;
30 case 6: mo = "June"; break;
31 case 7: mo = "July"; break;
32 case 8: mo = "August"; break;
33 case 9: mo = "September"; break;
34 case 10: mo = "October"; break;
35 case 11: mo = "November"; break;
36 case 12: mo = "December"; break;
37 case 0: mo = "????"; break;
38 default: cgierr("I don't know any month > 12","","");
39 }
40
41 if (!stralloc_copys(dt,mo)) return -1;
42 if (!stralloc_cats(dt," ")) return -1;
43 if ((d/100)) {
44 if (!stralloc_catb(dt,strnum,fmt_ulong(strnum,d/100))) return -1;
45 } else
46 if (!stralloc_cats(dt,"????")) return 0;
47 return 1;
48}
void cgierr(const char *s, const char *s1, const char *s2)
Definition ezmlm-cgi.c:209
struct datetime dt
Definition ezmlm-cgi.c:174
int dateline(stralloc *dt, unsigned long d)
Definition dateline.c:20