calendar.h revision 13877
113877Swosch/*
213877Swosch * Copyright (c) 1989, 1993, 1994
313877Swosch *	The Regents of the University of California.  All rights reserved.
413877Swosch *
513877Swosch * Redistribution and use in source and binary forms, with or without
613877Swosch * modification, are permitted provided that the following conditions
713877Swosch * are met:
813877Swosch * 1. Redistributions of source code must retain the above copyright
913877Swosch *    notice, this list of conditions and the following disclaimer.
1013877Swosch * 2. Redistributions in binary form must reproduce the above copyright
1113877Swosch *    notice, this list of conditions and the following disclaimer in the
1213877Swosch *    documentation and/or other materials provided with the distribution.
1313877Swosch * 3. All advertising materials mentioning features or use of this software
1413877Swosch *    must display the following acknowledgement:
1513877Swosch *	This product includes software developed by the University of
1613877Swosch *	California, Berkeley and its contributors.
1713877Swosch * 4. Neither the name of the University nor the names of its contributors
1813877Swosch *    may be used to endorse or promote products derived from this software
1913877Swosch *    without specific prior written permission.
2013877Swosch *
2113877Swosch * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2213877Swosch * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2313877Swosch * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2413877Swosch * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2513877Swosch * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2613877Swosch * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2713877Swosch * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2813877Swosch * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2913877Swosch * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3013877Swosch * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3113877Swosch * SUCH DAMAGE.
3213877Swosch */
3313877Swosch
3413877Swosch
3513877Swoschextern struct passwd *pw;
3613877Swoschextern int doall;
3713877Swoschextern struct iovec header[];
3813877Swoschextern struct tm *tp;
3913877Swoschextern char *calendarFile;
4013877Swoschextern char *optarg;
4113877Swosch
4213877Swoschvoid	 cal __P((void));
4313877Swoschvoid	 closecal __P((FILE *));
4413877Swoschint	 getday __P((char *));
4513877Swoschint	 getdayvar __P((char *));
4613877Swoschint	 getfield __P((char *, char **, int *));
4713877Swoschint	 getmonth __P((char *));
4813877Swoschint	 geteaster __P((char *, int));
4913877Swoschint      easter __P((int));
5013877Swoschint	 isnow __P((char *));
5113877SwoschFILE	*opencal __P((void));
5213877Swoschvoid	 settime __P((time_t));
5313877Swoschtime_t   Mktime __P((char *));
5413877Swoschvoid	 usage __P((void));
5513877Swosch
5613877Swosch#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
5713877Swosch
5813877Swosch/* some flags */
5913877Swosch#define	F_ISMONTH	0x01 /* month (Januar ...) */
6013877Swosch#define	F_ISDAY		0x02 /* day of week (Sun, Mon, ...) */
6113877Swosch#define	F_ISDAYVAR	0x04 /* variables day of week, like SundayLast */
6213877Swosch#define	F_EASTER	0x08 /* Easter or easter depending days */
6313877Swosch
6413877Swoschextern f_dayAfter; /* days after current date */
6513877Swoschextern f_dayBefore; /* days bevore current date */
66