bday

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