nisstat.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) 1988-1992 Sun Microsystems Inc
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* This program will print out the various statistics being maintained by
* the NIS+ server.
*/
#include <stdio.h>
#include <string.h>
static struct statlist {
int stat_type;
char *stat_name;
char stat_data[80];
} statlist[] = {
{ TAG_ROOTSERVER, "root server", },
{ TAG_NISCOMPAT, "NIS compat mode", },
{ TAG_DNSFORWARDING, "DNS forwarding in NIS mode", },
{ TAG_SECURITY_LEVEL, "security level", },
{ TAG_DIRLIST, "serves directories", },
{ TAG_OPSTATS, "Operation Statistics", },
{ TAG_S_DCACHE, "directory cache", },
{ TAG_S_GCACHE, "group cache", },
{ TAG_S_STORAGE, "static storage", },
{ TAG_HEAP, "dynamic storage", },
{ TAG_UPTIME, "up since", },
{ 0, NULL, }};
extern int optind;
extern char *optarg;
static void
usage(s)
char *s;
{
exit(1);
}
/*
* Print all the names of the directories served by this server
* This list comes in a space separated buffer.
*/
static void
char *header;
char *dirlist;
{
char *t, *tmp;
exit(1);
}
/* we will print the list in the reverse order */
*t = NULL;
printf("\t%s\n", t + sizeof (char));
}
}
/*
* Print all statistical information on this server.
* This list comes in a "\n" separated buffer.
*/
static void
char *header;
char *statlist;
{
char *t, *tmp;
exit(1);
}
*t = NULL;
if (first) {
/* dont print this */
tmp = t + sizeof (char);
continue;
}
}
tmp = t + sizeof (char);
}
}
static
int
{
return (1);
return (0);
}
int argc;
char *argv[];
{
switch (c) {
case 'H' :
break;
default :
break;
}
}
else
/* expand the name if not fully qualified */
else
exit(1);
}
exit(1);
}
}
maxtag = i;
for (i = 0; i < ns; i++) {
continue;
if (print_once)
printf("\n");
else
print_once = TRUE;
if (status != NIS_SUCCESS) {
"nisstat: Error talking to host \"%s\": %s\n",
continue;
}
nis_compat = FALSE;
for (j = 0; j < maxtag; j++) {
/* Dont print this one */
continue;
case TAG_OPSTATS:
break;
case TAG_DIRLIST:
break;
case TAG_NISCOMPAT:
nis_compat = TRUE;
printf("Stat '%s' = '%s'\n",
break;
case TAG_DNSFORWARDING:
/*
* Assume that the TAG_NISCOMPAT
* answer comes first
*/
if (nis_compat == FALSE)
break; /* Dont print this answer */
/* else fall through */
default:
printf("Stat '%s' = '%s'\n",
break;
}
}
}
exit(0);
}