Mercurial > bday
comparison birthday.c @ 5:5af6bf2cb271
reads only stdin now, no files anymore; removed -f option aswell; code beatifing
author | meillo@marmaro.de |
---|---|
date | Mon, 17 Dec 2007 15:09:03 +0100 |
parents | dc2f94280b01 |
children | fc6e40f7bd5a |
comparison
equal
deleted
inserted
replaced
4:5326c222cd4e | 5:5af6bf2cb271 |
---|---|
32 #include "birthday.h" | 32 #include "birthday.h" |
33 | 33 |
34 | 34 |
35 int main(int argc, char* argv[]) | 35 int main(int argc, char* argv[]) |
36 { | 36 { |
37 char* fname = NULL; | |
38 struct event *evl; /* evl => event list */ | 37 struct event *evl; /* evl => event list */ |
39 | 38 |
40 while (--argc > 0 && (*++argv)[0] == '-') { | 39 while (--argc > 0 && (*++argv)[0] == '-') { |
41 if (strcmp(argv[0], "-f") == 0) { | 40 if (strcmp(argv[0], "-W") == 0) { |
42 fname = strdup((++argv)[0]); | |
43 argc--; | |
44 } else if (strcmp(argv[0], "-W") == 0) { | |
45 iDWarn = atoi((++argv)[0]); | 41 iDWarn = atoi((++argv)[0]); |
46 argc--; | 42 argc--; |
47 } else { | 43 } else { |
48 fprintf(stderr, "unknown option %s\n", argv[0]); | 44 fprintf(stderr, "unknown option %s\n", argv[0]); |
49 exit(1); | 45 exit(1); |
50 } | 46 } |
51 } | 47 } |
52 | 48 |
53 evl = readlist(fname); /* read and format entries */ | 49 evl = readlist(); /* read and format entries */ |
54 | |
55 liststrings(evl, puts); | 50 liststrings(evl, puts); |
56 | 51 |
57 return 0; | 52 return 0; |
58 } | 53 } |