/*
* 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 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* processor date)
*/
#include <libintl.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <langinfo.h>
#include "librsc.h"
#include "adm.h"
static void ADM_Get_Date();
static int ADM_twodigits(char *s);
static void usage();
void
{
int largc;
usage();
exit(-1);
}
if (argc == 3) {
usage();
exit(-1);
}
}
}
ADM_Start();
if (argc == 2) {
ADM_Get_Date();
} else if (argc == 3) {
largc = 3;
} else {
}
}
}
static void
{
DP_GET_DATE_TIME_R, sizeof (dp_get_date_time_r_t));
gettext("scadm: could not read date from SC"));
exit(-1);
}
/* Print the date */
}
static void
{
if (argc < 3) {
/* should have caught this earlier */
gettext("scadm: arguments error in set date"));
exit(-1);
}
/* should have caught this earlier */
gettext("scadm: INTERNAL ERROR in set date"));
exit(-1);
}
/* Correct month to be 0 - 11. Why does firmware want this? */
/* Correct year to be offset from 1900. Why does firmware want this? */
DP_SET_DATE_TIME_R, sizeof (dp_set_date_time_r_t));
gettext("scadm: could not set date on SC"));
exit(-1);
}
}
static int
ADM_twodigits(char *s)
{
int n;
n = ((s[0] - '0') * 10) + (s[1] - '0');
return (n);
}
static int
{
int localDate;
/* HHMM */
return (-1);
return (-1);
/* HHMM.SS */
return (-1);
return (-1);
return (-1);
/* mmddHHMM */
return (-1);
return (-1);
return (-1);
return (-1);
/* mmddHHMM.SS */
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
/* mmddHHMMyy */
if (localDate > 70)
else
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
/* mmddHHMMyy.SS */
if (localDate > 70)
else
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
/* mmddHHMMccyy */
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
/* mmddHHMMccyy.SS */
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
} else {
return (-1);
}
return (0);
}
static void
usage()
{
gettext("USAGE: scadm date [-s] "
"| [[mmdd]HHMM | mmddHHMM[cc]yy][.SS]\n"
" 1 <= mm <= 12\n"
" 1 <= dd <= 31\n"
" 1 <= HH <= 23\n"
" 0 <= MM <= 59\n"
" 1970 <= ccyy <= 2038\n"
" 0 <= SS <= 59"));
}