1 |
578 |
markom |
/* MI Option Parser.
|
2 |
|
|
Copyright 2000 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Cygnus Solutions (a Red Hat company).
|
4 |
|
|
|
5 |
|
|
This file is part of GDB.
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
10 |
|
|
(at your option) any later version.
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
20 |
|
|
Boston, MA 02111-1307, USA. */
|
21 |
|
|
|
22 |
|
|
#ifndef MI_GETOPT_H
|
23 |
|
|
#define MI_GETOPT_H
|
24 |
|
|
|
25 |
|
|
/* Like getopt() but with simpler semantics.
|
26 |
|
|
|
27 |
|
|
An option has the form ``-<name>''. The special option ``--''
|
28 |
|
|
denotes the end of the option list. An option can be followed by a
|
29 |
|
|
separate argument (on a per option basis).
|
30 |
|
|
|
31 |
|
|
On entry OPTIND contains the index of the next element of ARGV that
|
32 |
|
|
needs parsing. OPTIND is updated to indicate the index of the next
|
33 |
|
|
argument before mi_getopt() returns.
|
34 |
|
|
|
35 |
|
|
If ARGV[OPTIND] is an option, that options INDEX is returned.
|
36 |
|
|
OPTARG is set to the options argument or NULL. OPTIND is updated.
|
37 |
|
|
|
38 |
|
|
If ARGV[OPTIND] is not an option, -1 is returned and OPTIND updated
|
39 |
|
|
to specify the non-option argument. OPTARG is set to NULL.
|
40 |
|
|
|
41 |
|
|
mi_getopt() calls ``error("%s: Unknown option %c", prefix,
|
42 |
|
|
option)'' if an unknown option is encountered. */
|
43 |
|
|
|
44 |
|
|
struct mi_opt;
|
45 |
|
|
extern int mi_getopt (const char *prefix, int argc, char **argv,
|
46 |
|
|
struct mi_opt *opt, int *optind, char **optarg);
|
47 |
|
|
|
48 |
|
|
/* The option list. Terminated by NAME==NULL. ARG_P that the option
|
49 |
|
|
requires an argument. INDEX is returned to identify th option. */
|
50 |
|
|
|
51 |
|
|
struct mi_opt
|
52 |
|
|
{
|
53 |
|
|
const char *name;
|
54 |
|
|
int index;
|
55 |
|
|
int arg_p;
|
56 |
|
|
};
|
57 |
|
|
|
58 |
|
|
struct mi_opt;
|
59 |
|
|
|
60 |
|
|
#endif
|