calendar.h revision 181323
1168404Spjd/* 2168404Spjd * Copyright (c) 1989, 1993, 1994 3168404Spjd * The Regents of the University of California. All rights reserved. 4168404Spjd * 5168404Spjd * Redistribution and use in source and binary forms, with or without 6168404Spjd * modification, are permitted provided that the following conditions 7168404Spjd * are met: 8168404Spjd * 1. Redistributions of source code must retain the above copyright 9168404Spjd * notice, this list of conditions and the following disclaimer. 10168404Spjd * 2. Redistributions in binary form must reproduce the above copyright 11168404Spjd * notice, this list of conditions and the following disclaimer in the 12168404Spjd * documentation and/or other materials provided with the distribution. 13168404Spjd * 3. All advertising materials mentioning features or use of this software 14168404Spjd * must display the following acknowledgement: 15168404Spjd * This product includes software developed by the University of 16168404Spjd * California, Berkeley and its contributors. 17168404Spjd * 4. Neither the name of the University nor the names of its contributors 18168404Spjd * may be used to endorse or promote products derived from this software 19168404Spjd * without specific prior written permission. 20168404Spjd * 21168404Spjd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22168404Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23168404Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24168404Spjd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25168404Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26168404Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27168404Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28168404Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29168404Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30168404Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31168404Spjd * SUCH DAMAGE. 32168404Spjd * 33168404Spjd * $FreeBSD: head/usr.bin/calendar/calendar.h 181323 2008-08-05 08:16:37Z edwin $ 34168404Spjd */ 35168404Spjd 36168404Spjd#include <sys/types.h> 37218180Smm#include <sys/uio.h> 38218180Smm 39218180Smmextern struct passwd *pw; 40218180Smmextern int doall; 41218180Smmextern struct iovec header[]; 42218180Smmextern struct tm *tp; 43168404Spjdextern const char *calendarFile; 44168404Spjdextern int *cumdays; 45168404Spjdextern int yrdays; 46168404Spjdextern struct fixs neaster, npaskha; 47168404Spjd 48219089Spjdvoid cal(void); 49174040Sjbvoid closecal(FILE *); 50174040Sjbint getday(char *); 51174040Sjbint getdayvar(char *); 52174040Sjbint getfield(char *, char **, int *); 53174040Sjbint getmonth(char *); 54185029Spjdint geteaster(char *, int); 55174040Sjbint getpaskha(char *, int); 56174040Sjbint easter(int); 57174040Sjbint isnow(char *, int *, int *, int *); 58174040SjbFILE *opencal(void); 59174040Sjbvoid settime(time_t); 60174040Sjbtime_t Mktime(char *); 61185029Spjdvoid setnnames(void); 62185029Spjd 63219089Spjd#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) 64168404Spjd 65168404Spjd/* some flags */ 66168404Spjd#define F_ISMONTH 0x01 /* month (January ...) */ 67168404Spjd#define F_ISDAY 0x02 /* day of week (Sun, Mon, ...) */ 68168404Spjd#define F_ISDAYVAR 0x04 /* variables day of week, like SundayLast */ 69168404Spjd#define F_EASTER 0x08 /* Easter or easter depending days */ 70168404Spjd 71168404Spjdextern int f_dayAfter; /* days after current date */ 72168404Spjdextern int f_dayBefore; /* days before current date */ 73168962Spjdextern int Friday; /* day before weekend */ 74185029Spjd 75168404Spjdstruct fixs { 76168404Spjd char *name; 77184698Srodrigc int len; 78174040Sjb}; 79174040Sjb