carta
wn_freeargs(3)

wn_freeargs3

Parse string into unix-style arguments

Part of wnargv(3).

Usage

int argc;

char *argv [] ;

char string [] ;

char *out_argv [] ,*in_argv [] ;

int argc;

int argc;

char *argv [] ;

Overview

These routines create and operate on UNIX-style argc-argv arguments.

wn_parse_into_args parses string into UNIX-style argc-argv arguments. argc is the number of arguments parsed, called the argument count. argv is an array of argument strings, of length argc+1. argv[argc] is always set to NULL. Normally, argv[0] is interpreted as a command, while argv[1], argv[2], ... are interpreted as the command's arguments.

Caution: argv is allocated from static memory, which is re-used on each call to wn_parse_into_args. Thus, a call to wn_parse_into_args destroys the argv produced by previous calls. Use wn_argscpy to prevent this.

wn_argscpy places a copy of in_argv into out_argv. out_argv is assumed to have argc arguments. New memory for out_argv is allocated from the current memory group.

wn_freeargs frees an argv from wn_argscpy (into the current memory group).

Author

Will Naylor

From libwn-dev 6.0-17 in Debian 4.0 (Etch). Parsed by carta from the page's man source.