/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef lint
#endif
/* Import. */
#include "port_before.h"
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "port_after.h"
#ifdef SPRINTF_CHAR
#else
#endif
/* Forward. */
static int datepart(const char *, int, int, int, int *);
/* Public. */
/*%
* Convert a date in ASCII into the number of seconds since
* 1 January 1970 (GMT assumed). Format is yyyymmddhhmmss, all
* digits required, no spaces allowed.
*/
int mdays, i;
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
*errp = 1;
return (0);
}
*errp = 0;
if (*errp) /*%< Any parse errors? */
return (0);
/*
* OK, now because timegm() is not available in all environments,
* we will do it by hand. Roll up sleeves, curse the gods, begin!
*/
/* Months are trickier. Look without leaping, then leap */
mdays = 0;
mdays += days_per_month[i];
/* First figure years without leapdays, then add them in. */
/* The loop is slow, FIXME, but simple and accurate. */
if (isleap(1900+i))
return (result);
}
/* Private. */
/*%
* Parse part of a date. Set error flag if any error.
* Don't reset the flag if there is no error.
*/
static int
int result = 0;
int i;
for (i = 0; i < size; i++) {
*errp = 1;
}
*errp = 1;
*errp = 1;
return (result);
}
/*! \file */