Mercurial > bday
comparison birthday.c @ 0:22b6e71de68e
initial commit; codebase from birthday; just the needed stuff; substituted getopt by own code
author | meillo@marmaro.de |
---|---|
date | Sun, 16 Dec 2007 22:26:48 +0100 |
parents | |
children | dc2f94280b01 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:22b6e71de68e |
---|---|
1 /* | |
2 birthday | |
3 | |
4 Birthday/Anniversary display on login | |
5 | |
6 (c) 1996 AS Mortimer | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. You may also | |
12 distribute it under the Artistic License, as comes with Perl. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program; if not, write to the Free Software | |
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | |
22 You should also have recieved a copy of the Artistic license with | |
23 this program. | |
24 | |
25 $Id: birthday.c,v 1.5 1999/04/25 14:01:29 andy Exp $ | |
26 */ | |
27 | |
28 #include <string.h> | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 | |
32 #include "birthday.h" | |
33 | |
34 | |
35 int main(int argc, char* argv[]) | |
36 { | |
37 char* fname = NULL; | |
38 struct event *evl; /* evl => event list */ | |
39 char* opt = NULL; | |
40 | |
41 while (--argc > 0 && (*++argv)[0] == '-') { | |
42 if (strcmp(argv[0], "-f") == 0) { | |
43 fname = strdup((++argv)[0]); | |
44 argc--; | |
45 } else if (strcmp(argv[0], "-W") == 0) { | |
46 iDWarn = atoi((++argv)[0]); | |
47 argc--; | |
48 } else if (strcmp(argv[0], "-M") == 0) { | |
49 iMaxWarn = atoi((++argv)[0]); | |
50 argc--; | |
51 } else if (strcmp(argv[0], "-m") == 0) { | |
52 iMinWarn = atoi((++argv)[0]); | |
53 argc--; | |
54 } else { | |
55 fprintf(stderr, "unknown option %s\n", opt); | |
56 exit(1); | |
57 } | |
58 } | |
59 | |
60 evl = readlist(fname); /* read and format entries */ | |
61 | |
62 liststrings(evl, puts); | |
63 | |
64 return 0; | |
65 } |