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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/birthday.c	Sun Dec 16 22:26:48 2007 +0100
     1.3 @@ -0,0 +1,65 @@
     1.4 +/*
     1.5 +   birthday
     1.6 +
     1.7 +   Birthday/Anniversary display on login
     1.8 +
     1.9 +   (c) 1996 AS Mortimer
    1.10 +
    1.11 +    This program is free software; you can redistribute it and/or
    1.12 +    modify it under the terms of the GNU General Public License as
    1.13 +    published by the Free Software Foundation; either version 2 of the
    1.14 +    License, or (at your option) any later version.  You may also
    1.15 +    distribute it under the Artistic License, as comes with Perl.
    1.16 +
    1.17 +    This program is distributed in the hope that it will be useful,
    1.18 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.19 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.20 +
    1.21 +    You should have received a copy of the GNU General Public License
    1.22 +    along with this program; if not, write to the Free Software
    1.23 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.24 +
    1.25 +    You should also have recieved a copy of the Artistic license with
    1.26 +    this program.
    1.27 +
    1.28 +   $Id: birthday.c,v 1.5 1999/04/25 14:01:29 andy Exp $
    1.29 +*/
    1.30 +
    1.31 +#include <string.h>
    1.32 +#include <stdio.h>
    1.33 +#include <stdlib.h>
    1.34 +
    1.35 +#include "birthday.h"
    1.36 +
    1.37 +
    1.38 +int main(int argc, char* argv[])
    1.39 +{
    1.40 +  char* fname = NULL;
    1.41 +  struct event *evl; /* evl => event list */
    1.42 +  char* opt = NULL;
    1.43 +
    1.44 +  while (--argc > 0 && (*++argv)[0] == '-') {
    1.45 +    if (strcmp(argv[0], "-f") == 0) {
    1.46 +			fname = strdup((++argv)[0]);
    1.47 +			argc--;
    1.48 +		} else if (strcmp(argv[0], "-W") == 0) {
    1.49 +			iDWarn = atoi((++argv)[0]);
    1.50 +			argc--;
    1.51 +		} else if (strcmp(argv[0], "-M") == 0) {
    1.52 +			iMaxWarn = atoi((++argv)[0]);
    1.53 +			argc--;
    1.54 +		} else if (strcmp(argv[0], "-m") == 0) {
    1.55 +			iMinWarn = atoi((++argv)[0]);
    1.56 +			argc--;
    1.57 +		} else {
    1.58 +			fprintf(stderr, "unknown option %s\n", opt);
    1.59 +			exit(1);
    1.60 +		}
    1.61 +	}
    1.62 +
    1.63 +  evl = readlist(fname); /* read and format entries */
    1.64 +
    1.65 +	liststrings(evl, puts);
    1.66 +
    1.67 +  return 0;
    1.68 +}