/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
#include "libadm.h"
static int fmtcheck(char *);
static char *p_ndigit(char *, int *, int);
static char *p_date(char *, int, int, int);
static char *p_eday(char *, int, int);
static char *p_dlm(char *, char);
/*
* All digits are valid for a YY year format
* 70-99 refer to the 20th Century
* 00-69 refer to the 21st Century
*/
#define LY 00
static void
{
fmt = "%m/%d/%y";
}
static char *
{
char *ptr;
int accum = 0;
if (!string)
return (NULL);
return (NULL);
}
if (n)
return (NULL);
return (ptr);
}
static char *
{
char *ptr;
return (NULL);
return (ptr);
else
return (NULL);
}
static char *
{
int iday = 0;
daynum[0] = '\0';
string++;
idaymax--;
}
iday++;
}
if (iday == 1) {
llim = 1;
ulim = 9;
} else if (iday == 2) {
llim = 10;
ulim = 31;
}
if (iday == 0)
return (NULL);
return (NULL);
return (ptr);
else
return (NULL);
}
/* p_month will parse the string for the month - abbr. form i.e. JAN - DEC */
static char *
{
static char *fmonth[] = {
"JANUARY", "FEBRUARY", "MARCH", "APRIL",
"MAY", "JUNE", "JULY", "AUGUST",
"SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
};
static char *amonth[] = {
"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
};
char *copy;
int mlen;
int imnth = 0;
int legit = 0;
int n = 0;
if (mnabr == 'a') {
mlen = 3;
} else {
mlen = 9;
}
imnth++;
}
while (!(legit) && (n < 12)) {
n++;
}
if (legit) {
string++;
}
return (string);
/*
* I know this causes side effects, but it's less
* code than adding in a copy for string and using that
*/
} else
return (NULL);
}
static char *
{
char dlm;
if (! string)
return (NULL);
if (dchoice == '/')
else
}
int
{
return (4);
return (0);
}
int
{
return (4);
return (0);
}
/*
* A little state machine that checks out the format to
* make sure it is acceptable.
* return value 1: NG
* return value 0: OK
*/
static int
{
int percent = 0;
while (*fmt) {
switch (*fmt++) {
case '%': /* previous state must be start or letter */
if (percent == 0)
percent = 1;
else
return (1);
break;
case 'd': /* previous state must be "%" */
case 'e':
case 'm':
case 'y':
case 'Y':
case 'D':
case 'h':
case 'b':
case 'B':
if (percent == 1)
percent = 0;
else
return (1);
break;
case TAB: /* previous state must be start or letter */
case BLANK:
case DELIM1:
case DELIM2:
if (percent == 1)
return (1);
break;
default:
return (1);
}
}
return (percent);
}
int
{
return (4);
ltrl = '\0';
if ((*fmt) == '%') {
fmt++;
switch (*fmt) {
case 'd':
if (!input)
valid = 0;
break;
case 'e':
if (!input)
valid = 0;
break;
case 'm':
if (!input)
valid = 0;
break;
case 'y':
if (!input)
valid = 0;
break;
case 'Y':
if (!input)
valid = 0;
break;
case 'D':
if (!input) {
valid = 0;
break;
}
if (!input) {
valid = 0;
break;
}
if (!input) {
valid = 0;
break;
}
if (!input) {
valid = 0;
break;
}
if (!input)
valid = 0;
break;
case 'h':
case 'b':
if (!input)
valid = 0;
break;
case 'B':
if (!input)
valid = 0;
break;
default:
input++;
}
} else {
dfl = '\0';
input++;
}
fmt++;
} /* end of while fmt and valid */
valid = 0;
}
return ((valid == 0));
}
int
char *prompt)
{
*ept = '\0';
return (4);
if (!prompt)
return (1);
if (defstr) {
return (0);
}
goto start;
goto start;
return (3);
goto start;
}
return (0);
}