home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
forum7.lzh
/
RICO
/
MAN
/
man.makeargv
< prev
next >
Wrap
Text File
|
1988-09-26
|
999b
|
43 lines
makeargv - build an argv-style array from a string
SYNOPSIS
int makeargv(str, argvp)
char *str;
char ***argvp;
DESCRIPTION
makeargv breaks up an ordinary string into a count and array like
those passed to main() as argc & argv.
Argv is MALLOC'd in makeargv; to free it, call FREE(argv).
The first arg is placed in argv[0].
The original string is peppered with null chars to mark the ends of
the args, and argv[i] is filled with pointers into the original string.
An extra entry of NULL is included in argv, at argv[argc], for routines
that use a final NULL for loop termination.
EXAMPLE
#include <argproc.h>
char **argv;
int argc;
char cmdline[256], arg[256];
boolean xflag;
gets(cmdline);
argc = makeargv(cmdline, &argv);
argproc(argc+1, argv-1, "%s =x", arg, &xflag);
BUGS
Perhaps this should set argv[0] to the empty string
to be more compatible with the real argv[].
LIBRARY
Use argproc.l