2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * Copyright (c) 1989, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * All digits are valid for a YY year format 2N/A * 70-99 refer to the 20th Century 2N/A * 00-69 refer to the 21st Century 2N/A/* p_month will parse the string for the month - abbr. form i.e. JAN - DEC */ 2N/A "JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
2N/A "MAY",
"JUNE",
"JULY",
"AUGUST",
2N/A "SEPTEMBER",
"OCTOBER",
"NOVEMBER",
"DECEMBER" 2N/A "JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
2N/A "JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC" 2N/A legit =
1;
/* found legitimate string */ 2N/A * I know this causes side effects, but it's less 2N/A * code than adding in a copy for string and using that 2N/A * A little state machine that checks out the format to 2N/A * make sure it is acceptable. 2N/A * return value 1: NG 2N/A * return value 0: OK 2N/A case '%':
/* previous state must be start or letter */ 2N/A case 'd':
/* previous state must be "%" */ 2N/A case TAB:
/* previous state must be start or letter */ 2N/A int valid =
1;
/* time of day string is valid for format */ 2N/A }
/* end of while fmt and valid */