2012-07-05 Hui Zhu <hui_zhu@mentor.com>

* breakpoint.c (check_for_argument): Move to file cli/cli-utils.c.
	* cli/cli-utils.c (check_for_argument): New function.
	* cli/cli-utils.h (check_for_argument): Ditto.
This commit is contained in:
Hui Zhu 2012-07-05 01:00:43 +00:00
parent 38401e4002
commit e6f0bce70d
4 changed files with 26 additions and 17 deletions

View File

@ -1,3 +1,9 @@
2012-07-05 Hui Zhu <hui_zhu@mentor.com>
* breakpoint.c (check_for_argument): Move to file cli/cli-utils.c.
* cli/cli-utils.c (check_for_argument): New function.
* cli/cli-utils.h (check_for_argument): Ditto.
2012-07-04 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention x32 ABI support.

View File

@ -11085,23 +11085,6 @@ watch_command_wrapper (char *arg, int from_tty, int internal)
watch_command_1 (arg, hw_write, from_tty, 0, internal);
}
/* A helper function that looks for an argument at the start of a
string. The argument must also either be at the end of the string,
or be followed by whitespace. Returns 1 if it finds the argument,
0 otherwise. If the argument is found, it updates *STR. */
static int
check_for_argument (char **str, char *arg, int arg_len)
{
if (strncmp (*str, arg, arg_len) == 0
&& ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len])))
{
*str += arg_len;
return 1;
}
return 0;
}
/* A helper function that looks for the "-location" argument and then
calls watch_command_1. */

View File

@ -286,3 +286,17 @@ extract_arg (char **arg)
return copy;
}
/* See documentation in cli-utils.h. */
int
check_for_argument (char **str, char *arg, int arg_len)
{
if (strncmp (*str, arg, arg_len) == 0
&& ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len])))
{
*str += arg_len;
return 1;
}
return 0;
}

View File

@ -114,4 +114,10 @@ extern char *remove_trailing_whitespace (const char *start, char *s);
extern char *extract_arg (char **arg);
/* A helper function that looks for an argument at the start of a
string. The argument must also either be at the end of the string,
or be followed by whitespace. Returns 1 if it finds the argument,
0 otherwise. If the argument is found, it updates *STR. */
extern int check_for_argument (char **str, char *arg, int arg_len);
#endif /* CLI_UTILS_H */