Example of shell parsing.
Example of shell parsing.
#ifndef DEBUG
#define DEBUG
#endif
#include <stdio.h>
extern "C" int main()
{
int test_argc;
char *test_argv[6];
shell::bind("test");
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(is(rflag));
assert(*lines == 5);
assert(args() == 2);
assert(eq(args[0], "a"));
prefix = shell::path(shell::SYSTEM_PREFIX);
subdir = shell::path(shell::SYSTEM_PREFIX, "test");
basedir = shell::path(shell::SYSTEM_PREFIX, "/test");
prefix = prefix + "/test";
assert(eq(basedir, "/test"));
assert(eq(subdir, prefix));
}
Top level include file for the GNU uCommon C++ core library.
Common namespace for all ucommon objects.
A utility class for generic shell operations.
Flag option for shell parsing.
Numeric option for shell parsing.
A copy-on-write string class that operates by reference count.