/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* pnpsplit splits interval into prime & nonprime portions
*/
#include <stdio.h>
#include "acctdef.h"
#include <time.h>
#include <ctype.h>
/*
* from holidays file fall within proper boundaries.
* Time is expected in the form and range of 0000-2400.
*/
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
/*
* prime(0) and nonprime(1) times during a day
* for BTL, prime time is 9AM to 5PM
*/
static struct hours {
} h[4];
long tmsecs();
/*
* values, return as result
* input values in seconds
*/
int
{
long tmp;
int sameday;
char *memcpy();
/* once holidays file is read, this is zero */
return(0);
}
if (sameday) {
break;
} else {
}
} else { /* working day, PRIME or NONPRIME */
/* WHCC mod, change from = to += 3/6/86 Paul */
break; /* all done */
} else { /* time to next PRIME /NONPRIME change */
}
}
}
}
return(1);
}
/*
* Starting day after Christmas, complain if holidays not yet updated.
* This code is only executed once per program invocation.
*/
int
checkhol()
{
time_t t;
if(inithol() == 0) {
thisyear = 0;
holidays[0] = -1;
return(0);
}
time(&t);
"***UPDATE %s WITH NEW HOLIDAYS***\n", HOLFILE);
thisyear = 0; /* checkhol() will not be called again */
return(1);
}
/*
* ssh returns 1 if Sat, Sun, or Holiday
*/
int
{
int i;
return(1);
for (i = 0; holidays[i] >= 0; i++)
return(1);
return(0);
}
/*
* inithol - read from an ascii file and initialize the "thisyear"
* variable, the times that prime and non-prime start, and the
* holidays array.
*/
int
inithol()
{
register int line = 0,
holindx = 0,
errflag = 0;
char *c;
return(0);
}
/* skip over blank lines and comments */
if (holbuf[0] == '*')
continue;
/* is a space */;
if (*c == '\0')
continue;
"%s: bad {yr ptime nptime} conversion\n",
HOLFILE);
errflag++;
break;
}
/* validate year */
thisyear);
errflag++;
break;
}
errflag++;
break;
}
/* Set up start of prime time; 2400 == 0000 */
h[0].h_sec = 0;
/* Set up start of non-prime time; 2400 == 2360 */
h[1].h_sec = 0;
} else {
h[1].h_sec = 0;
}
/* This is the end of the day */
h[2].h_sec = 0;
/* The end of the array */
continue;
}
errflag++;
break;
}
/* Fill up holidays array from holidays file */
errflag++;
break;
}
errflag++;
break;
}
}
return(1);
}
else
return(0);
}
/*
* tmsecs returns number of seconds from t1 to t2,
* times expressed in localtime format.
* assumed that t1 <= t2, and are in same day.
*/
long
{
}
/*
* return 1 if t1 earlier than t2 (times in localtime format)
* assumed that t1 and t2 are in same day
*/
int
{
}
/* set day of year from month and day */
int
{
int i, leap;
for (i = 1; i < month; i++)
return(day);
}