/*
* 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 2004 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 <stdio.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>
#include <valtools.h>
#include <stdlib.h>
#include <locale.h>
#include <libintl.h>
#include <limits.h>
#include <wchar.h>
#include "usage.h"
#include "libadm.h"
static char *prog;
static int signo;
static int ninvis = 0;
#define INTERR \
"%s: ERROR: internal error occurred while attempting menu setup\n"
#define MYOPTS \
"\t-f file #file containing choices\n" \
"\t-l label #menu label\n" \
"\t-i invis [, ...] #invisible menu choices\n" \
"\t-m max #maximum choices user may select\n" \
"\t-n #do not sort choices alphabetically\n" \
"\t-o #don't prompt if only one choice\n" \
"\t-u #unnumbered choices\n"
static void
usage(void)
{
switch (*prog) {
default:
break;
case 'h':
gettext("\t-W width\n\t-h help\n"));
break;
case 'e':
gettext("\t-W width\n\t-e error\n"));
break;
}
exit(1);
}
/*
* Given argv[0], return a pointer to the basename of the program.
*/
static char *
{
char *str;
/* first strip trailing '/' characters (exec() allows these!) */
*str = '\0';
return (str + 1);
return (arg0);
}
int
{
int c, i;
char **item;
size_t n, r;
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
if (!invis) {
gettext("Not enough memory\n"));
exit(1);
}
/* check for invalid option */
usage(); /* no valid options */
usage();
switch (c) {
case 'Q':
ckquit = 0;
break;
case 'W':
if (ckwidth < 0) {
gettext("%s: ERROR: negative display width specified\n"),
prog);
exit(1);
}
break;
case 'm':
gettext("%s: ERROR: too large or too small max value specified\n"),
prog);
exit(1);
}
break;
case 'o':
break;
case 'n':
break;
case 'i':
if (ninvis == invismaxsize) {
invismaxsize * sizeof (char *));
if (!invis) {
gettext("Not enough memory\n"));
exit(1);
}
(invismaxsize - ninvis) *
sizeof (char *));
}
break;
case 'l':
break;
case 'f':
gettext("%s: ERROR: can't open %s\n"),
exit(1);
}
break;
case 'u':
break;
case 'd':
break;
case 'p':
break;
case 'e':
break;
case 'h':
break;
case 'k':
break;
case 's':
break;
default:
usage();
}
}
if (signo) {
usage();
} else
if (fp) {
*wtemp = L'\0';
/*
* Skip comment lines, those beginning with '#'.
* Note: AT&T forgot this & needs the next 2 lines.
*/
if (*wline == L'#')
continue;
/*
* if the line begins with a space character,
* this is a continuous line to the previous line.
*/
} else {
if (*wtemp) {
n * MB_LEN_MAX);
if (r == (size_t)-1) {
gettext("Invalid character in the menu definition.\n"));
exit(1);
}
exit(1);
}
}
}
}
if (*wtemp) {
if (r == (size_t)-1) {
gettext("Invalid character in the menu definition.\n"));
exit(1);
}
exit(1);
}
}
}
exit(1);
}
}
for (n = 0; n < ninvis; ) {
exit(1);
}
}
if (*prog == 'e') {
ckindent = 0;
exit(0);
} else if (*prog == 'h') {
ckindent = 0;
exit(0);
}
if (max < 1) {
} else {
}
/*
* if -o option is specified, mp->nchoices is 1, and if no invisible
* item is specified, ckitem() will consume two entries of item,
* even though 'max' is set to 1. So to take care of that problem, we
* allocate one extra element for item
*/
if (!item) {
gettext("Not enough memory\n"));
exit(1);
}
if (n == 3) {
if (kpid > -2)
(void) puts("q");
} else if (n == 0) {
i = 0;
while (item[i])
}
return (n);
}