Example of shell parsing.
#ifndef DEBUG
#define DEBUG
#endif
#include <stdio.h>
extern "C" int main()
{
int test_argc;
char *test_argv[6];
test_argc = 5;
test_argv[0] = (char *)"test";
test_argv[1] = (char *)"--lines=5";
test_argv[2] = (char *)"-r";
test_argv[3] = (char *)"a";
test_argv[4] = (char *)"b";
test_argv[5] = NULL;
shell args(test_argc, test_argv);
assert(!tflag);
assert(*lines == 5);
assert(args() == 2);
assert(
eq(args[0],
"a"));
prefix = prefix + "/test";
assert(
eq(basedir,
"/test"));
assert(
eq(subdir, prefix));
}