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];
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));
}
Top level include file for the GNU uCommon C++ core library.
Common namespace for all ucommon objects.
String string_t
A convenience type for string.
bool eq(const struct sockaddr *s1, const struct sockaddr *s2)
Compare two socket addresses to see if equal.
bool is(T &object)
Convenience function to validate object assuming it is castable to bool.
A utility class for generic shell operations.
static String path(path_t id)
Get a system path.
static void bind(const char *name)
Bind application to text domain for internationalization.
Flag option for shell parsing.
Numeric option for shell parsing.