calendar.h revision 98181
168349Sobrien/* 2133359Sobrien * Copyright (c) 1989, 1993, 1994 3133359Sobrien * The Regents of the University of California. All rights reserved. 4133359Sobrien * 5133359Sobrien * Redistribution and use in source and binary forms, with or without 6133359Sobrien * modification, are permitted provided that the following conditions 7133359Sobrien * are met: 8133359Sobrien * 1. Redistributions of source code must retain the above copyright 9133359Sobrien * notice, this list of conditions and the following disclaimer. 10133359Sobrien * 2. Redistributions in binary form must reproduce the above copyright 11133359Sobrien * notice, this list of conditions and the following disclaimer in the 12133359Sobrien * documentation and/or other materials provided with the distribution. 13133359Sobrien * 3. All advertising materials mentioning features or use of this software 14133359Sobrien * must display the following acknowledgement: 15133359Sobrien * This product includes software developed by the University of 16133359Sobrien * California, Berkeley and its contributors. 17133359Sobrien * 4. Neither the name of the University nor the names of its contributors 18133359Sobrien * may be used to endorse or promote products derived from this software 19133359Sobrien * without specific prior written permission. 20133359Sobrien * 21133359Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22133359Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23133359Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24133359Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25133359Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26133359Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27133359Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28133359Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2968349Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3068349Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3168349Sobrien * SUCH DAMAGE. 3268349Sobrien * 3368349Sobrien * $FreeBSD: head/usr.bin/calendar/calendar.h 98181 2002-06-13 21:20:56Z grog $ 3468349Sobrien */ 3568349Sobrien 36191736Sobrien 37191736Sobrienextern struct passwd *pw; 38191736Sobrienextern int doall; 39191736Sobrienextern struct iovec header[]; 40191736Sobrienextern struct tm *tp; 41133359Sobrienextern const char *calendarFile; 4268349Sobrienextern char *optarg; 4368349Sobrien 4468349Sobrienvoid cal(void); 4568349Sobrienvoid closecal(FILE *); 4668349Sobrienint getday(char *); 47133359Sobrienint getdayvar(char *); 48169942Sobrienint getfield(char *, char **, int *); 4968349Sobrienint getmonth(char *); 5068349Sobrienint geteaster(char *, int); 5168349Sobrienint getpaskha(char *, int); 52169962Sobrienint easter(int); 53169962Sobrienint isnow(char *, int *, int *, int *); 54169962SobrienFILE *opencal(void); 55175296Sobrienvoid settime(time_t); 56175296Sobrientime_t Mktime(char *); 57103373Sobrienvoid usage(void); 58103373Sobrienvoid setnnames(void); 59103373Sobrien 60186690Sobrien#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) 61186690Sobrien 62133359Sobrien/* some flags */ 63186690Sobrien#define F_ISMONTH 0x01 /* month (Januar ...) */ 64133359Sobrien#define F_ISDAY 0x02 /* day of week (Sun, Mon, ...) */ 6568349Sobrien#define F_ISDAYVAR 0x04 /* variables day of week, like SundayLast */ 6668349Sobrien#define F_EASTER 0x08 /* Easter or easter depending days */ 6775937Sobrien 6875937Sobrienextern int f_dayAfter; /* days after current date */ 6975937Sobrienextern int f_dayBefore; /* days bevore current date */ 7068349Sobrienextern int Friday; /* day before weekend */ 7168349Sobrien 7268349Sobrienstruct fixs { 7368349Sobrien char *name; 7468349Sobrien int len; 75159764Sobrien}; 76159764Sobrien 7780588Sobrien