OLD | NEW |
1 /* CLI utilities. | 1 /* CLI utilities. |
2 | 2 |
3 Copyright (c) 2011-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2011-2013 Free Software Foundation, Inc. |
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, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 extern char *skip_spaces (char *inp); | 95 extern char *skip_spaces (char *inp); |
96 | 96 |
97 /* A const-correct version of the above. */ | 97 /* A const-correct version of the above. */ |
98 | 98 |
99 extern const char *skip_spaces_const (const char *inp); | 99 extern const char *skip_spaces_const (const char *inp); |
100 | 100 |
101 /* Skip leading non-whitespace characters in INP, returning an updated | 101 /* Skip leading non-whitespace characters in INP, returning an updated |
102 pointer. If INP is NULL, return NULL. */ | 102 pointer. If INP is NULL, return NULL. */ |
103 | 103 |
104 extern char *skip_to_space (char *inp); | 104 #define skip_to_space(INP) ((char *) skip_to_space_const (INP)) |
| 105 |
| 106 /* A const-correct version of the above. */ |
| 107 |
| 108 extern const char *skip_to_space_const (const char *inp); |
105 | 109 |
106 /* Reverse S to the last non-whitespace character without skipping past | 110 /* Reverse S to the last non-whitespace character without skipping past |
107 START. */ | 111 START. */ |
108 | 112 |
109 extern char *remove_trailing_whitespace (const char *start, char *s); | 113 extern char *remove_trailing_whitespace (const char *start, char *s); |
110 | 114 |
111 /* A helper function to extract an argument from *ARG. An argument is | 115 /* A helper function to extract an argument from *ARG. An argument is |
112 delimited by whitespace. The return value is either NULL if no | 116 delimited by whitespace. The return value is either NULL if no |
113 argument was found, or an xmalloc'd string. */ | 117 argument was found, or an xmalloc'd string. */ |
114 | 118 |
115 extern char *extract_arg (char **arg); | 119 extern char *extract_arg (char **arg); |
116 | 120 |
| 121 /* A const-correct version of "extract_arg". |
| 122 |
| 123 Since the returned value is xmalloc'd, it eventually needs to be |
| 124 xfree'ed, which prevents us from making it const as well. */ |
| 125 |
| 126 extern char *extract_arg_const (const char **arg); |
| 127 |
117 /* A helper function that looks for an argument at the start of a | 128 /* A helper function that looks for an argument at the start of a |
118 string. The argument must also either be at the end of the string, | 129 string. The argument must also either be at the end of the string, |
119 or be followed by whitespace. Returns 1 if it finds the argument, | 130 or be followed by whitespace. Returns 1 if it finds the argument, |
120 0 otherwise. If the argument is found, it updates *STR. */ | 131 0 otherwise. If the argument is found, it updates *STR. */ |
121 extern int check_for_argument (char **str, char *arg, int arg_len); | 132 extern int check_for_argument (char **str, char *arg, int arg_len); |
122 | 133 |
123 #endif /* CLI_UTILS_H */ | 134 #endif /* CLI_UTILS_H */ |
OLD | NEW |