From: kramm Date: Tue, 23 Oct 2001 16:58:23 +0000 (+0000) Subject: moved from src and pdf2swf into the lib directory, as it's used by both. X-Git-Tag: release-0-0-2~15 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=843ff64cdad227d56714c268244a60f517351973 moved from src and pdf2swf into the lib directory, as it's used by both. --- diff --git a/lib/args.h b/lib/args.h new file mode 100644 index 0000000..0e99360 --- /dev/null +++ b/lib/args.h @@ -0,0 +1,92 @@ +/* args.h + Routines to simplify argument handling + + Part of the swftools package. + + Copyright (c) 2001 Matthias Kramm + + This file is distributed under the GPL, see file COPYING for details */ + +#ifndef __args_h__ +#define __args_h__ + +extern int args_callback_option(char*,char*); +extern int args_callback_longoption(char*,char*); +extern int args_callback_command(char*,char*); +extern void args_callback_usage(char*name); + +int argn; +char**argv; + +void processargs(int argn2,char**argv2) +{ + int t; + if(argn2==1) + { + args_callback_usage(argv2[0]); + exit(1); + } + for(t=1;tshortoption) { + if(!strcmp(options->longoption, name)) { + char*tmp = (char*)malloc(strlen(options->shortoption) + +(equal?strlen(equal)+2:2)); + strcpy(tmp, options->shortoption); + if(equal) { + strcpy(&tmp[strlen(tmp)], equal); + } + return args_callback_option(tmp,val); + } + options++; + } + fprintf(stderr, "Unknown option: --%s\n", name); + exit(1); +} + +#endif //__args_h__