sagb.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.5 */
/* sagb.c 1.5 of 5/13/85 */
#include "saghdr.h"
struct p *p;
int pn;
{
int a, b, c;
int i;
int qi = 0;
char *strcpy();
}
{
{ /* End of file */
break;
}
{ /* One or both is a constant */
else
{
case '+':
break;
case '-':
break;
case '*':
break;
case '/':
else
break;
default:
break;
}
{ /* a is variable */
a++;
}
{ /* b is variable */
b++;
}
else
{ /* Both are constant */
a++;
b++;
}
c++;
continue;
}
{ /* b missing */
valb = 0.;
a++;
}
{ /* a missing */
vala = 0.;
b++;
}
else
{ /* a & b hrs equal */
/*
** Test which index can be incremented without
** incurring a change in ..hr
*/
{ /* a free, b constrained */
qi = 0;
a++;
}
{ /* a constrained, b free */
qi = 1;
b++;
}
else
{ /* Both free or both constrained */
if(qi == 1)
else
a++;
b++;
}
}
else
{
case '+':
break;
case '-':
break;
case '*':
break;
case '/':
if(valb != 0)
else
break;
default:
break;
}
c++;
}
}
{
}
}
/************************************************/
char *name;
/*
** Extracts data from sarc[] array and puts into
** array entries. Hunts for name string among column
** headers in sarc, and copies following data items
** from corresponding field up to next "Average" line.
** Special treatment when name string contains an integer
** or "time".
*/
{
extern long sardoff;
int fnum;
int nparts;
int i, j;
int timeflg;
int nmloc;
double atof();
float hour;
char *strcpy();
char *strtok();
char *tok;
{ /* no sar data is required */
return(0);
}
{ /* 1st sar group - %usr */
nparts = 1;
timeflg = 1;
}
else
{
nparts = 0;
timeflg = 0;
{
nparts = 1;
}
{
nparts++;
}
else
}
/* fprintf(stderr, "nparts:%d nm:%s ql:%s\n", nparts, nm, ql);
*/
{
for(i=0; i<fnum; i++)
{
if(timeflg == 1)
{
nmloc = 0;
}
else
{
nmloc = i ;
if(nparts < 2)
else
}
goto readin;
}
}
return(-1);
for(i=0; i<NPTS; )
{
{
return(0);
}
if(DEBUG>1) {
for (j=0; j<fnum; j++)
}
if(timeflg == 1)
{
i++;
continue;
}
{
i++;
continue;
}
continue;
if(DEBUG>1)
i++;
}
return(0);
}
/************************************************/
getfld()
/*
** Scans characters pointed to by cp;
** puts non-blank strings into fld[NFLD][FLDCH]
** up to first newline or EOF.
** Returns number of fld's filled (or EOF),
** with cp updated to next readable char.
*/
{
int fnum=0, i=0;
int c;
switch((char)c){
case ' ':
i = 0;
break;
case '\n':
return(++fnum);
break;
default:
break;
}
else return(++fnum);
}
/************************************************/
&stack[0],
&stack[1],
&stack[2],
&stack[3],
&stack[4],
&stack[5],
&stack[6],
&stack[7],
&stack[8],
&stack[9]};
static int spn = 10;
{
if(spn > 0)
else
{
exit();
}
}
{
if(spn < 10)
{
return(1);
}
else
{
return(0);
}
}
/************************************************/
stribl(s)
char *s;
/*
** Strips leading and trailing blanks from string
** by moving string pointer to first non-blank character,
** and replacing trailing blanks with '\0'.
** Returns number of remaining characters.
*/
{
char *a, *b;
a = b = s;
while (*b == ' ') b++;
while ((*a++ = *b++) != '\0');
a--;
while (a-- > s)
if (*a != ' ') break;
else *a = '\0';
return (int)(a-s+1);
}
/************************************************/
/*
** strmatch looks for an occurrence of string pat
** inside string targ. It returns the number of
** the first starting character position (zero is valid),
** or -1 for no match.
*/
{
int i, c, ifirst;
{
i=0;
do
{
if(pat[i] == '\0')
return(ifirst);
return(-1);
c=i++;
}
}
}
/************************************************/
float ff;
{
float div = 1;
int i = 0;
if (ff <= 0.) return(0);
}