2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-05-16 08:51:13 quinn
8 * License, documentation, and memory fixes
10 * Revision 1.1 1995/03/27 08:35:18 quinn
11 * Created util library
12 * Added memory debugging module. Imported options-manager
14 * Revision 1.2 1994/10/04 17:47:10 adam
15 * Function options now returns arg with error option.
17 * Revision 1.1 1994/08/16 15:57:22 adam
18 * The first utility modules.
25 static int arg_no = 1;
26 static int arg_off = 0;
28 int options (const char *desc, char **argv, int argc, char **arg)
36 if (argv[arg_no][0] != '-')
38 *arg = argv[arg_no++];
43 ch = argv[arg_no][arg_off++];
46 int desc_char = desc[i++];
49 { /* string argument */
53 { /* option with argument */
56 if (argv[arg_no][arg_off])
58 *arg = argv[arg_no]+arg_off;
67 *arg = argv[arg_no++];
72 else /* option with no argument */
74 if (argv[arg_no][arg_off])
85 *arg = argv[arg_no]+arg_off-1;