X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Foptions.c;h=591a329881f8d04ed58cf916153581c371589a1f;hp=3dc74a6c034f591a027e3be0836b0fdd4dcdd499;hb=19af2bd8dfd21731cc978beccd1346133d614c67;hpb=63cafe41a93427118959a74201b3e331169a71d9 diff --git a/util/options.c b/util/options.c index 3dc74a6..591a329 100644 --- a/util/options.c +++ b/util/options.c @@ -1,10 +1,23 @@ /* - * Copyright (c) 1995, Index Data + * Copyright (c) 1995-2000, Index Data * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: options.c,v $ - * Revision 1.4 1995-09-29 17:12:35 quinn + * Revision 1.8 2000-02-29 13:44:55 adam + * Check for config.h (currently not generated). + * + * Revision 1.7 1999/11/30 13:47:12 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.6 1997/09/01 08:54:13 adam + * New windows NT/95 port using MSV5.0. Made prefix query handling + * thread safe. The function options ignores empty arguments when met. + * + * Revision 1.5 1995/12/06 13:00:19 adam + * Minus alone not treated as an option. + * + * Revision 1.4 1995/09/29 17:12:35 quinn * Smallish * * Revision 1.3 1995/09/27 15:03:03 quinn @@ -24,9 +37,13 @@ * The first utility modules. * */ +#if HAVE_CONFIG_H +#include +#endif + #include -#include +#include static int arg_no = 1; static int arg_off = 0; @@ -39,7 +56,13 @@ int options (const char *desc, char **argv, int argc, char **arg) return -2; if (arg_off == 0) { - if (argv[arg_no][0] != '-') + while (argv[arg_no][0] == '\0') + { + arg_no++; + if (arg_no >= argc) + return -2; + } + if (argv[arg_no][0] != '-' || argv[arg_no][1] == '\0') { *arg = argv[arg_no++]; return 0;