tester3.c

Tue, 15 Feb 2005 18:57:52 +0100

author
tailor@f281.ttorni.ton.tut.fi
date
Tue, 15 Feb 2005 18:57:52 +0100
changeset 0
86b7f6f9c5c0
child 3
b1fbfab67908
permissions
-rw-r--r--

Tailorization of trunk
Import of the upstream sources from the repository

http://tao.uab.es/ion/svn/libtu/trunk

as of revision 2

/*
 * libtu/tester3.c
 *
 * Copyright (c) Tuomo Valkonen 1999-2000.
 * 
 * This file is distributed under the terms of the "Artistic License".
 * See the included file LICENSE for details.
 */

#include <stdio.h>
#include "include/util.h"
#include "include/misc.h"
#include "include/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_IMM_ARG},
	{'f',	"file",		OPT_CHAINABLE|OPT_NO_DASH|OPT_ARG},
	{'v',	"view",		OPT_CHAINABLE|OPT_NO_DASH},
	{'z',	"zip",		OPT_CHAINABLE|OPT_NO_DASH},
	{'x',	"extract",	OPT_CHAINABLE|OPT_NO_DASH},
	{0, NULL, 0}
};
	

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