/*
* Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2013 Nexenta Systems. All rights reserved.
*/
/*
* Test client for kwarnd. This program is not shipped on the binary
* release. This code was taken and modified from gssdtest.c
*/
#include <stdio.h>
#include <strings.h>
#include <ctype.h>
#include <stdlib.h>
#include "kwarnd.h"
static void instructs(void);
static void usage(void);
static int parse_input_line(char *, int *, char ***);
static void _kwarnd_add_warning(int, char **);
static void _kwarnd_del_warning(int, char **);
static int do_kwarndtest(char *buf);
extern OM_UINT32 kwarn_add_warning();
extern OM_UINT32 kwarn_del_warning();
{
int len;
/* read the next line. If cntl-d, return with zero char count */
return (0);
return (len);
}
int
main()
{
/* Print out usage and instructions to start off the session */
instructs();
usage();
/*
* Loop, repeatedly calling parse_input_line() to get the
* next line and parse it into argc and argv. Act on the
* arguements found on the line.
*/
do {
if (len)
return (0);
}
static int
{
int argc;
char *cmd;
argv = 0;
return (1);
}
if (argc == 0) {
usage();
return (0);
}
/*
* remember argv_array address, which is memory calloc'd by
* parse_input_line, so it can be free'd at the end of the loop.
*/
argv_array = argv;
argc--;
argv++;
return (1);
} else
usage();
/* free argv array */
return (0);
}
static void
{
/* set up the arguments specified in the input parameters */
if (argc == 0) {
usage();
return;
}
if (argc != 2) {
usage();
return;
}
if (status == 0) {
argv[0]);
} else {
}
return;
}
static void
{
if (argc != 1) {
usage();
return;
}
if (status == 0) {
"for %s successful"),
argv[0]);
} else {
argv[0]);
}
}
static void
instructs(void)
{
"\nThis program will test kwarnd. kwarnd must be running as root. Enter\n"
"principal, also include the expiration time in seconds.\n"));
}
static void
usage(void)
{
"\nusage:\t[kwarn_add_warning | add] (principal) (exptime)\n"
"\t[kwarn_del_warning | delete] (principal)\n"
"\texit\n\n"));
}
/* Copied from parse_argv(), then modified */
static int
{
char *chptr;
int chr_cnt;
int arg_cnt = 0;
int ch_is_space;
/* Count the arguments in the input_line string */
*argc = 1;
if (ch_is_space && !ch_was_space) {
(*argc)++;
}
}
if (ch_was_space) {
(*argc)--;
} /* minus trailing spaces */
/* Now that we know how many args calloc the argv array */
chptr = (char *)(&input_line[0]);
if (ch_is_space) {
} else if (ch_was_space) { /* begining of word? */
}
}
return (chr_cnt);
}