NAME
octarg, hexarg - parse octal or hexadecimal argument or ask
user
SYNOPSIS
unsigned int octarg (ptr,brk,prompt,min,max,defalt);
const char **ptr,*brk,*prompt;
unsigned int min,max,defalt;
unsigned int hexarg
(ptr,brk,prompt,min,max,defalt);
const char **ptr,*brk,*prompt;
unsigned int min,max,defalt;
DESCRIPTION
octarg and hexarg 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 octal or hexadecimal value between min and max, then
this
value is returned by octarg or hexarg. If there is no
argument, or
it is not a legal value, then an error message is printed
and the
remaining parameters are passed into getoct(3) or gethex(3),
whose
value will be returned by octarg or hexarg.
A legal octal value is a
sequence of octal digits. A legal
hexadecimal value is a sequence of digits "0"
through "9", "a"
through "f", or "A" through
"F", and optionally preceded by the
(ignored) prefix "0x" or "0X".
octarg and hexarg are especially
useful for parsing octal and
hexadecimal values from argument lists in programs using the
command interpreter, ci(3).
SEE ALSO
nxtarg(3), getoct(3), gethex(3), atoo(3), atoh(3), ci(3)