NAME
intarg, longarg, shortarg - parse integer argument or ask
user
SYNOPSIS
#include <ctype.h>
#include <stdio.h>
int intarg
(ptr,brk,prompt,min,max,defalt);
const char **ptr,*brk,*prompt;
int min,max,defalt;
long longarg
(ptr,brk,prompt,min,max,defalt);
const char **ptr,*brk,*prompt;
long min,max,defalt;
short shortarg
(ptr,brk,prompt,min,max,defalt);
const char **ptr,*brk,*prompt;
short min,max,defalt;
DESCRIPTION
Intarg, longarg, and shortarg attempt to parse an argument
from a
string, passing the string pointer ptr and the break
character set
brk to the nxtarg(3) routine. If there is an argument
parsed, and
it is a legal integer whose value is between min and max,
then its
value is returned by intarg, longarg, or shortarg. If there
is no
argument, or it is not a valid integer, or the value is out
of
range, then an error message is printed and the remaining
arguments
are passed to getint(3), getlong(3), or getshort(3). The
resulting
value is then returned by intarg, longarg, or shortarg.
Intarg, longarg, and shortarg
are especially useful for parsing
integer values from argument lists in programs using the
command
interpreter, ci(3).
SEE ALSO
nxtarg(3), getint(3), getlong(3), getshort(3), ci(3)