/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 */
/*
* Copyright (c) 1997,1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
*/
/*LINTLIBRARY*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include "libadm.h"
static int fmtcheck(char *);
#define LH 00
#define LM 00
#define LS 00
static void
{
}
static char *
{
char *ptr;
int accum = 0;
int n = 2;
if (!string)
return (0);
return (NULL);
}
if (n)
return (NULL);
return (ptr);
}
static char *
{
char *ptr;
return (NULL);
return (ptr);
else return (NULL);
}
static char *
{
int legit, n;
legit = 0;
n = 0;
while (!(legit) && (n < 4)) {
n++;
}
if (legit)
return (string+2);
return (NULL);
}
static char *
{
char dlm;
if (! string)
return (NULL);
}
int
{
return (4);
ltrl = '\0';
if ((*fmt) == '%') {
switch (*++fmt) {
case 'H':
if (!input)
valid = 0;
break;
case 'M':
if (!input)
valid = 0;
break;
case 'S':
if (!input)
valid = 0;
break;
case 'T':
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 'R':
if (!input) {
valid = 0;
break;
}
if (!input) {
valid = 0;
break;
}
if (!input) {
valid = 0;
break;
}
break;
case 'r':
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;
}
if (!input) {
valid = 0;
break;
}
if (!input)
valid = 0;
break;
case 'I':
if (!input)
valid = 0;
break;
case 'p':
if (!input)
valid = 0;
break;
default:
}
} else {
dfl = '\0';
input++;
}
fmt++;
}
valid = 0;
return ((valid == 0));
}
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
*/
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 'H': /* previous state must be "%" */
case 'M':
case 'S':
case 'T':
case 'R':
case 'r':
case 'I':
case 'p':
if (percent == 1)
percent = 0;
else
return (1);
break;
case TAB: /* previous state must be start or letter */
case BLANK:
case DELIM1:
if (percent == 1)
return (1);
break;
default:
return (1);
}
}
return (percent);
}
int
char *prompt)
{
return (4);
if (!prompt)
prompt = "Enter a time of day";
return (1);
if (defstr) {
return (0);
}
goto start;
}
goto start;
}
return (3);
goto start;
}
return (0);
}