Mercurial > bday
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/birthday.c Sun Dec 16 22:26:48 2007 +0100 @@ -0,0 +1,65 @@ +/* + birthday + + Birthday/Anniversary display on login + + (c) 1996 AS Mortimer + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. You may also + distribute it under the Artistic License, as comes with Perl. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + You should also have recieved a copy of the Artistic license with + this program. + + $Id: birthday.c,v 1.5 1999/04/25 14:01:29 andy Exp $ +*/ + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +#include "birthday.h" + + +int main(int argc, char* argv[]) +{ + char* fname = NULL; + struct event *evl; /* evl => event list */ + char* opt = NULL; + + while (--argc > 0 && (*++argv)[0] == '-') { + if (strcmp(argv[0], "-f") == 0) { + fname = strdup((++argv)[0]); + argc--; + } else if (strcmp(argv[0], "-W") == 0) { + iDWarn = atoi((++argv)[0]); + argc--; + } else if (strcmp(argv[0], "-M") == 0) { + iMaxWarn = atoi((++argv)[0]); + argc--; + } else if (strcmp(argv[0], "-m") == 0) { + iMinWarn = atoi((++argv)[0]); + argc--; + } else { + fprintf(stderr, "unknown option %s\n", opt); + exit(1); + } + } + + evl = readlist(fname); /* read and format entries */ + + liststrings(evl, puts); + + return 0; +}