timex.c revision 1337fffa3690437b89871837ee0ccf7d2f44fae3
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <strings.h>
#include <time.h>
#include <errno.h>
#include <pwd.h>
char fname[20];
/*
* Quant[0] will get set to HZ/10 later.
*/
void hmstime(char[]);
void diag(char *);
int
{
int status;
register pid_t p;
int c;
char cmd[80];
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",
fld[19]);
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\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";
void
{
int digit[11];
int i;
char c;
int nonzero;
for (i = 0; i < 11; 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;
*/
void
{
char *ltime;
}
void
diag(char *s)
{
exit(1);
}