timex.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 */
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.19 */
/* timex.c 1.19 of 7/21/89 */
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#include <pwd.h>
long atol();
int isatty();
char *ttyname();
char *strcat();
char *strncpy();
extern int errno;
extern char *sys_errlist[];
char fname[20];
/*
* Quant[0] will get set to HZ/10 later.
*/
int argc;
char **argv;
{
int status;
register pid_t p;
int c;
char cmd[80];
extern char *optarg;
extern int optind;
char aopt[25];
char eol;
/* initalize quant array using the sysconf() */
/* check options; */
switch (c) {
case 's': sflg++; break;
case 'o': oflg++; break;
case 'p': pflg++; break;
break;
}
/*
* Check to see if accounting is installed and print a somewhat
* meaninful message if not.
*/
oflg = 0;
pflg = 0;
"Information from -p and -o options not available\n");
" because process accounting is not operational.\n");
}
if (sflg) {
}
if (p == 0) {
exit(1);
}
if ((status&0377) != 0)
if (isatty(0))
if (pflg)
if (oflg) {
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
if (++iline == 3)
for (i = 0; i < nfld; i++) {
== 0)
ichar = i+2;
== 0)
iblok = i+2;
}
if (iline > 4) {
}
}
}
if (oflg)
if (iline > 4)
"\nCHARS TRNSFD = %ld\nBLOCKS READ = %ld\n",
else
"\nNo process records found!\n");
}
if (sflg) {
}
}
char *pad = "000 ";
char *sep = "\0\0.\0:\0:\0\0";
char *nsep = "\0\0.\0 \0 \0\0";
printt(s, a)
char *s;
time_t a;
{
char digit[9];
register i;
char c;
int nonzero;
for (i = 0; i < 9; i++) {
a /= quant[i];
}
nonzero = 0;
while (--i > 0) {
nonzero ? '0':
pad[i];
}
}
/*
** hmstime() sets current time in hh:mm:ss string format in stime;
*/
char stime[];
{
char *ltime;
}
diag(s)
char *s;
{
exit(1);
}