tester3.c

Sat, 03 Jun 2000 19:00:43 +0200

author
tuomov
date
Sat, 03 Jun 2000 19:00:43 +0200
changeset 14
91f0c87b62a7
parent 12
5fd153b29d40
child 17
a034888a2227
permissions
-rw-r--r--

trunk: changeset 17
Default include path support

/*
 * libtu/tester3.c
 *
 * Copyright (c) Tuomo Valkonen 1999-2000. 
 * See the included file LICENSE for details.
 */

#include <stdio.h>

#include <libtu/util.h>
#include <libtu/misc.h>
#include <libtu/optparser.h>


static const char usage[]=
	"Usage: $p [options]\n"
	"\n"
	"Where options are:\n"
	"$o\n";
	

static OptParserOpt opts[]={
	{'o',	"opt", OPT_ARG, "OPTION", "foo bar baz quk asdf jklö äölk dfgh quik aaaa bbbb cccc dddd eeee ffff"},
	{'f',	"file", OPT_ARG, "FILE", "asdfsadlfölökjasdflökjasdflkjöasdflkjöas dlöfjkasdfölkjasdfölkjasdfasdflöjasdfkasödjlfkasdlföjasdölfjkölkasjdfasdfölkjasd asdöljfasöldf  asdölfköasdlf asfdlök asdföljkadsfölasdfölasdölkfjasdölfasödlflöskflasdföaölsdf"},
	{'v',	"view",	0, NULL, NULL},
	{'z',	"zip", 0, NULL, NULL},
	{'x',	"extract", 0, NULL, NULL},
	{0, NULL, 0, NULL, NULL}
};
	

int main(int argc, char *argv[])
{
	int opt;
	
	libtu_init(argv[0]);
	
	optparser_init(argc, argv, OPTP_NO_DASH, opts, NULL);
	
	while((opt=optparser_get_opt())){
		switch(opt){
		case 'o':
			printf("opt: %s\n", optparser_get_arg());
			break;
		case 'f':
			printf("file: %s\n", optparser_get_arg());
			break;
		case 'v':
			printf("view\n");
			break;
		case 'z':
			printf("zip\n");
			break;
		case 'x':
			printf("extract\n");
			break;
		default:
			optparser_print_error();
			return 1;
		}
	}
	return 0;
}

mercurial