tester3.c

Sun, 14 May 2000 18:58:42 +0200

author
tuomov
date
Sun, 14 May 2000 18:58:42 +0200
changeset 10
ab335fe0d26d
parent 9
55e7f2ff6021
child 12
5fd153b29d40
permissions
-rw-r--r--

trunk: changeset 13
Use $(ANSI_SOURCE)

/*
 * 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[]=
	"$u [options]\n"
	"\n"
	"Where options are:\n"
	"\n"
	"  -o, -f, -v, -z, -x\n"
	"$c                   \n"
	"\n";
	

static ProgInfo proginfo={
	"Tester III",
	"0.1",
	"foo",
	"bar",
	usage
};


static OptParserOpt opts[]={
	{'o',	"opt",		OPT_ARG},
	{'f',	"file",		OPT_ARG},
	{'v',	"view",		0},
	{'z',	"zip",		0},
	{'x',	"extract",	0},
	{0, NULL, 0}
};
	

int main(int argc, char *argv[])
{
	int opt;
	
	libtu_init(&argc, argv, &proginfo);
	
	optparser_init(argc, argv, OPTP_NO_DASH, opts);
	
	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