NAME
getoct, gethex - ask user to type an octal or hexadecimal integer

SYNOPSIS
#include <stdio.h>
#include <ctype.h>

unsigned int getoct (prompt,min,max,defalt);
const char *prompt;
unsigned int min,max,defalt;
unsigned int gethex (prompt,min,max,defalt);
const char *prompt;
unsigned int min,max,defalt;

DESCRIPTION
Getoct and gethex ask the user to type in an unsigned octal or
hexadecimal integer.

They begin by printing the string prompt as a message to the user.
The user then types in a number of the appropriate form. If the
number is valid and is within the range min to max, then it is
returned as the value of getoct or gethex. If it is invalid or is
out of range, then an error message is printed and the prompt-and-
response cycle is repeated. If the user types just a carriage
return, then the value defalt is assumed.

Getoct and gethex are identical, except in the manner in which the
user’s input is converted into an unsigned integer.

Getoct converts the input by assuming it represents a string of
octal digits. Leading blanks and tabs are ignored; conversion
stops at the first character which is not a legal octal digit. No
signs (+ or -) are allowed.

Gethex converts the input by assuming it represents a string of
hexadecimal digits. There may be leading blanks and tabs; in
addition, the digit string may be preceded by "0x" or "0X", which
will be ignored. The valid characters include "0" through "9", "a"
through "f", and "A" through "F". Conversion stops at the first
character which is not a legal hexadecimal digit. No signs (+ or
-) are allowed.

SEE ALSO
atoo (3), atoh (3), getint (3), getbool (3), getstr (3), etc.
octarg (3), hexarg (3)

BUGS
No provision is made for overflow.