---
name: "wnargv"
section: "3"
platform: "linux"
package: "libwn-dev"
version: "6.0-17"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/wnargv"
---

# wnargv(3)

parse string into UNIX-style arguments

## NAME

wn\_parse\_into\_args, wn\_argscpy, wn\_freeargs - parse string into UNIX-style arguments

## SYNOPSIS

```
wn_parse_into_args(&argc,&argv,string)
int argc;
char *argv[];
char string[];

wn_argscpy(&out_argv,argc,in_argv)
char *out_argv[],*in_argv[];
int argc;

wn_freeargs(argc,argv)
int argc;
char *argv[];

```

## DESCRIPTION

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).

## SEE ALSO

wnargp

## AUTHOR

Will Naylor
