2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1995-03-27 08:35:18 quinn
9 * Added memory debugging module. Imported options-manager
11 * Revision 1.2 1994/10/04 17:47:10 adam
12 * Function options now returns arg with error option.
14 * Revision 1.1 1994/08/16 15:57:22 adam
15 * The first utility modules.
22 static int arg_no = 1;
23 static int arg_off = 0;
25 int options (const char *desc, char **argv, int argc, char **arg)
33 if (argv[arg_no][0] != '-')
35 *arg = argv[arg_no++];
40 ch = argv[arg_no][arg_off++];
43 int desc_char = desc[i++];
46 { /* string argument */
50 { /* option with argument */
53 if (argv[arg_no][arg_off])
55 *arg = argv[arg_no]+arg_off;
64 *arg = argv[arg_no++];
69 else /* option with no argument */
71 if (argv[arg_no][arg_off])
82 *arg = argv[arg_no]+arg_off-1;