* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)getpar.c 4.4 (Berkeley) %G%";
printf("invalid input; please enter an integer\n");
** get floating parameter
printf("invalid input; please enter a double\n");
"y", "es", (int (*)())1, 0,
"n", "o", (int (*)())0, 0,
struct cvntab
*getcodpar(s
, tab
)
register struct cvntab
*r
;
cgetc(0); /* throw out the newline */
if ((c
= scanf("%[^ \t;\n]", input
)) < 0)
/* if command list, print four per line */
if (input
[0] == '?' && input
[1] == 0)
for (r
= tab
; r
->abrev
; r
++)
concat(r
->abrev
, r
->full
, input
);
printf("%14.14s", input
);
/* search for in table */
for (r
= tab
; r
->abrev
; r
++)
for (q
= r
->abrev
; *q
; q
++)
for (q
= r
->full
; *p
&& *q
; q
++, p
++)
/* check for not found */
printf("invalid input; ? for valid inputs\n");
sprintf(format
, "%%%d[^%s]", l
, t
);
** test if newline is next valid character
while ((c
= cgetc(0)) != '\n')
if ((c
>= '0' && c
<= '9') || c
== '.' || c
== '!' ||
(c
>= 'A' && c
<= 'Z') ||
(c
>= 'a' && c
<= 'z') || c
== '-')
** test for valid terminator
if (c
== '\n' || c
== ';')
** TEST FOR SPECIFIED DELIMETER
** The standard input is scanned for the parameter. If found,
** it is thrown away and non-zero is returned. If not found,