Rev 15487 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15487 | Rev 15509 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | int llcmp(const void *c1, const void *c2) |
26 | int llcmp(const void *c1, const void *c2) |
27 | { |
27 | { |
28 | char **p1,**p2; |
28 | char **p1,**p2; |
29 | p1=(char **) c1; p2=(char **) c2; |
29 | p1=(char **) c1; p2=(char **) c2; |
30 | return strcmp(*p1,*p2); |
30 | return strcmp(*p1,*p2); |
31 | } |
- | |
32 | int stringtodays(char * dat) |
- | |
33 | { |
- | |
34 | static int len[13] = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; |
- | |
35 | int y = 1000*(dat[0]-'0')+100*(dat[1]-'0')+10*(dat[2]-'0')+(dat[3]-'0'); |
- | |
36 | int m = 10*(dat[4]-'0')+(dat[5]-'0'); |
- | |
37 | int d = 10*(dat[6]-'0')+(dat[7]-'0'); |
- | |
38 | if (m < 3) {y--; d += 365;} |
- | |
39 | return d + len[m] + 365*y + y/4 - y/100 + y/400; |
- | |
40 | } |
- | |
41 | void purgefile(char *fname) |
- | |
42 | { |
- | |
43 | char buf[8]; |
- | |
44 | FILE *f = fopen(fname,"r"); |
- | |
45 | fread (buf,1,8,f); |
- | |
46 | fclose(f); |
- | |
47 | int d1 = stringtodays(buf); |
- | |
48 | int d2 = stringtodays(nowstr); |
- | |
49 | if (d2-d1 > 100) /* to replace by FILEROT */ |
- | |
50 | unlink(fname); |
- | |
51 | } |
31 | } |
52 | 32 | ||
53 | void onelogfile(char *fname) |
33 | void onelogfile(char *fname) |
54 | { |
34 | { |
55 | char namebuf[1024], b3[1024], b4[1024], *pp; |
35 | char namebuf[1024], b3[1024], b4[1024], *pp; |