Staging
v0.5.1
v0.5.1
Revision 6c41b80153a2e4ee347d0e968ee8d0d9abfc8862 authored by Junio C Hamano on 02 April 2008, 17:42:14 UTC, committed by Junio C Hamano on 02 April 2008, 18:13:25 UTC
The rate of fixes that trickle in has slowed and we are definitely getting there. Hopefully one final round and we will have the final 1.5.5 soon. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent eedb9d9
test-parse-options.c
#include "cache.h"
#include "parse-options.h"
static int boolean = 0;
static int integer = 0;
static char *string = NULL;
int main(int argc, const char **argv)
{
const char *usage[] = {
"test-parse-options <options>",
NULL
};
struct option options[] = {
OPT_BOOLEAN('b', "boolean", &boolean, "get a boolean"),
OPT_INTEGER('i', "integer", &integer, "get a integer"),
OPT_INTEGER('j', NULL, &integer, "get a integer, too"),
OPT_GROUP("string options"),
OPT_STRING('s', "string", &string, "string", "get a string"),
OPT_STRING(0, "string2", &string, "str", "get another string"),
OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
OPT_STRING('o', NULL, &string, "str", "get another string"),
OPT_GROUP("magic arguments"),
OPT_ARGUMENT("quux", "means --quux"),
OPT_END(),
};
int i;
argc = parse_options(argc, argv, options, usage, 0);
printf("boolean: %d\n", boolean);
printf("integer: %d\n", integer);
printf("string: %s\n", string ? string : "(not set)");
for (i = 0; i < argc; i++)
printf("arg %02d: %s\n", i, argv[i]);
return 0;
}
Computing file changes ...