2 * Simple Diary (aka Yet Another Reminder Program)
4 * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
19 struct entry *fe, **le = &fe;
22 scan(time_t when, int cnt)
24 struct tm *tm = localtime(&when);
28 sprintf(p, "%02d-%02d-%02d", tm->tm_mday, tm->tm_mon+1, tm->tm_year % 100);
29 for(e=fe; e; e=e->next)
36 if (*x != '?' && *x != *y)
50 if (y && y[1] && y[2] && y[3] == ')')
53 sscanf(y+1, "%d", &q);
54 sprintf(y+1, "%02d", tm->tm_year - q);
57 printf("%s:%s\n", p, xb);
63 main(int argc, char **argv)
67 time_t now = time(NULL);
69 if (argc < 2 || argc > 3)
71 fprintf(stderr, "Usage: diary <file> [<days>]\n");
74 f = fopen(argv[1], "r");
80 while (fgets(buf, 256, f))
82 char *b = strchr(buf, '\n');
88 if (buf[0] <= ' ' || buf[0] == '#')
90 e = malloc(sizeof(struct entry) + strlen(buf));
96 m = (argc > 2) ? atol(argv[2]) : 1;
101 now += 86401; /* Dirty trick... */