calendar.h revision 92920
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.
3259945Sphantom *
3359945Sphantom * $FreeBSD: head/usr.bin/calendar/calendar.h 92920 2002-03-22 01:22:50Z imp $
3413877Swosch */
3513877Swosch
3613877Swosch
3713877Swoschextern struct passwd *pw;
3813877Swoschextern int doall;
3913877Swoschextern struct iovec header[];
4013877Swoschextern struct tm *tp;
4187235Smarkmextern const char *calendarFile;
4213877Swoschextern char *optarg;
4313877Swosch
4492920Simpvoid	 cal(void);
4592920Simpvoid	 closecal(FILE *);
4692920Simpint	 getday(char *);
4792920Simpint	 getdayvar(char *);
4892920Simpint	 getfield(char *, char **, int *);
4992920Simpint	 getmonth(char *);
5092920Simpint	 geteaster(char *, int);
5192920Simpint      getpaskha(char *, int);
5292920Simpint      easter(int);
5392920Simpint	 isnow(char *, int *, int *, int *);
5492920SimpFILE	*opencal(void);
5592920Simpvoid	 settime(time_t);
5692920Simptime_t   Mktime(char *);
5792920Simpvoid	 usage(void);
5892920Simpvoid     setnnames(void);
5913877Swosch
6015714Sache#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
6113877Swosch
6213877Swosch/* some flags */
6313877Swosch#define	F_ISMONTH	0x01 /* month (Januar ...) */
6413877Swosch#define	F_ISDAY		0x02 /* day of week (Sun, Mon, ...) */
6513877Swosch#define	F_ISDAYVAR	0x04 /* variables day of week, like SundayLast */
6613877Swosch#define	F_EASTER	0x08 /* Easter or easter depending days */
6713877Swosch
6846081Simpextern int f_dayAfter; /* days after current date */
6946081Simpextern int f_dayBefore; /* days bevore current date */
7015720Sache
7115720Sachestruct fixs {
7215720Sache	char *name;
7315720Sache	int len;
7415720Sache};
7515720Sache
76