OLD | NEW |
1 /* MI Option Parser. | 1 /* MI Option Parser. |
2 Copyright (C) 2000, 2007-2012 Free Software Foundation, Inc. | 2 Copyright (C) 2000-2013 Free Software Foundation, Inc. |
3 Contributed by Cygnus Solutions (a Red Hat company). | 3 Contributed by Cygnus Solutions (a Red Hat company). |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 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 | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
11 | 11 |
12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
(...skipping 26 matching lines...) Expand all Loading... |
39 On entry OPTIND contains the index of the next element of ARGV that | 39 On entry OPTIND contains the index of the next element of ARGV that |
40 needs parsing. OPTIND is updated to indicate the index of the next | 40 needs parsing. OPTIND is updated to indicate the index of the next |
41 argument before mi_getopt() returns. | 41 argument before mi_getopt() returns. |
42 | 42 |
43 If ARGV[OPTIND] is an option, that options INDEX is returned. | 43 If ARGV[OPTIND] is an option, that options INDEX is returned. |
44 OPTARG is set to the options argument or NULL. OPTIND is updated. | 44 OPTARG is set to the options argument or NULL. OPTIND is updated. |
45 | 45 |
46 If ARGV[OPTIND] is not an option, -1 is returned and OPTIND updated | 46 If ARGV[OPTIND] is not an option, -1 is returned and OPTIND updated |
47 to specify the non-option argument. OPTARG is set to NULL. | 47 to specify the non-option argument. OPTARG is set to NULL. |
48 | 48 |
49 mi_getopt() calls ``error("%s: Unknown option %c", prefix, | 49 If an unknown option is encountered, mi_getopt() calls |
50 option)'' if an unknown option is encountered. */ | 50 ``error("%s: Unknown option %c", prefix, option)'' while |
| 51 mi_getopt_allow_unknown returns -1. */ |
51 | 52 |
52 extern int mi_getopt (const char *prefix, int argc, char **argv, | 53 extern int mi_getopt (const char *prefix, int argc, char **argv, |
53 const struct mi_opt *opt, int *optind, char **optarg); | 54 const struct mi_opt *opt, int *optind, char **optarg); |
| 55 extern int mi_getopt_allow_unknown (const char *prefix, int argc, |
| 56 char **argv, const struct mi_opt *opts, |
| 57 int *oind, char **oarg); |
54 | 58 |
55 /* mi_valid_noargs determines if ARGC/ARGV are a valid set of | 59 /* mi_valid_noargs determines if ARGC/ARGV are a valid set of |
56 parameters to satisfy an MI function that is not supposed to | 60 parameters to satisfy an MI function that is not supposed to |
57 recieve any arguments. | 61 recieve any arguments. |
58 | 62 |
59 An MI function that should not receive arguments can still be | 63 An MI function that should not receive arguments can still be |
60 passed parameters after the special option '--' such as below. | 64 passed parameters after the special option '--' such as below. |
61 | 65 |
62 Example: The MI function -exec-run takes no args. | 66 Example: The MI function -exec-run takes no args. |
63 However, the client may pass '-exec-run -- -a ...' | 67 However, the client may pass '-exec-run -- -a ...' |
64 See PR-783 | 68 See PR-783 |
65 | 69 |
66 PREFIX is passed to mi_getopt for an error message. | 70 PREFIX is passed to mi_getopt for an error message. |
67 | 71 |
68 This function Returns 1 if the parameter pair ARGC/ARGV are valid | 72 This function Returns 1 if the parameter pair ARGC/ARGV are valid |
69 for an MI function that takes no arguments. Otherwise, it returns 0 | 73 for an MI function that takes no arguments. Otherwise, it returns 0 |
70 and the appropriate error message is displayed by mi_getopt. */ | 74 and the appropriate error message is displayed by mi_getopt. */ |
71 | 75 |
72 extern int mi_valid_noargs (const char *prefix, int argc, char **argv); | 76 extern int mi_valid_noargs (const char *prefix, int argc, char **argv); |
73 | 77 |
74 #endif | 78 #endif |
OLD | NEW |