NAME
strarg, stabarg, searcharg - parse string argument or ask
user
SYNOPSIS
char *strarg (ptr,brk,prompt,defalt,buffer);
const char **ptr,*brk,*prompt;
const char *defalt,*buffer;
int stabarg
(ptr,brk,prompt,table,defalt);
const char **ptr,*brk,*prompt,**table,*defalt;
int searcharg
(ptr,brk,prompt,table,defalt);
const char **ptr,*brk,*prompt,**table,*defalt;
DESCRIPTION
Strarg will 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, then it is copied
into
buffer and strarg returns buffer as its value. If there is
no
argument, then prompt, defalt, and buffer are passed to
getstr(3),
whose value is returned by strarg.
Stabarg will attempt to parse an
argument in the same way. If
there is an argument, and it matches exactly one string in
the
string array table, then the index of the matching string is
returned by stabarg. If there is no argument, or if it
matches
nothing in the table or many entries of the table, then an
error
message is printed and the remaining arguments (prompt,
table, and
defalt) are passed into getstab(3). The value returned by
getstab
is then returned by stabarg.
Searcharg is just like stabarg,
but performs a heuristic test for
the best string match within the table, and allows the user
to
approve or disapprove this choice if it is not a perfect
match. If
the user does not approve the choice, several other good
matches
are listed.
Strarg, stabarg, and searcharg
are especially useful for parsing
strings from argument lists in programs using the command
interpreter, ci(3).
SEE ALSO
nxtarg(3), getstr(3), getstab(3), stlmatch(3), ci(3),
getsearch(3),
stabsearch(3), srchscore(3)