aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlee Dienes <kdienes@apple.com>2002-11-20 08:58:01 +0000
committerKlee Dienes <kdienes@apple.com>2002-11-20 08:58:01 +0000
commit4e87b8328c4d70b7b41de90b608c7181afd8751b (patch)
tree2775f6cf858ed95af487748f0a8a162bdadec532
parent193eb15dbaa0b2c9bf31134ed7be6a417b57b6e8 (diff)
downloadgdb-4e87b8328c4d70b7b41de90b608c7181afd8751b.zip
gdb-4e87b8328c4d70b7b41de90b608c7181afd8751b.tar.gz
gdb-4e87b8328c4d70b7b41de90b608c7181afd8751b.tar.bz2
2002-11-19 Klee Dienes <kdienes@apple.com>
Adam Fedor <fedor@gnu.org> * completer.c (skip_quoted_chars): Renamed from skip_chars. Add the ability to explicitly specify the quote characters and word break characters; if NULL is specified for either, use the old behavior of using the characters used by the completer. (skip_chars): New function. Convenience wrapper around skip_quoted_chars to provide the original skip_chars behavior. * completer.h (skip_quoted_chars): Add prototype.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/completer.c31
-rw-r--r--gdb/completer.h4
3 files changed, 39 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7589bd3..9dcab9b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2002-11-19 Klee Dienes <kdienes@apple.com>
+ Adam Fedor <fedor@gnu.org>
+
+ * completer.c (skip_quoted_chars): Renamed from skip_chars. Add
+ the ability to explicitly specify the quote characters and word
+ break characters; if NULL is specified for either, use the old
+ behavior of using the characters used by the completer.
+ (skip_chars): New function. Convenience wrapper around
+ skip_quoted_chars to provide the original skip_chars behavior.
+ * completer.h (skip_quoted_chars): Add prototype.
+
2002-11-19 Andrew Cagney <ac131313@redhat.com>
Problems reported by Paul Eggert.
diff --git a/gdb/completer.c b/gdb/completer.c
index 67ea300..7fa1759 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -678,16 +678,25 @@ line_completion_function (char *text, int matches, char *line_buffer, int point)
return (output);
}
-/* Skip over a possibly quoted word (as defined by the quote characters
- and word break characters the completer uses). Returns pointer to the
- location after the "word". */
+
+/* Skip over the possibly quoted word STR (as defined by the quote
+ characters QUOTECHARS and the the word break characters
+ BREAKCHARS). Returns pointer to the location after the "word". If
+ either QUOTECHARS or BREAKCHARS is NULL, use the same values used
+ by the completer. */
char *
-skip_quoted (char *str)
+skip_quoted_chars (char *str, char *quotechars, char *breakchars)
{
char quote_char = '\0';
char *scan;
+ if (quotechars == NULL)
+ quotechars = gdb_completer_quote_characters;
+
+ if (breakchars == NULL)
+ breakchars = gdb_completer_word_break_characters;
+
for (scan = str; *scan != '\0'; scan++)
{
if (quote_char != '\0')
@@ -700,16 +709,26 @@ skip_quoted (char *str)
break;
}
}
- else if (strchr (gdb_completer_quote_characters, *scan))
+ else if (strchr (quotechars, *scan))
{
/* Found start of a quoted string. */
quote_char = *scan;
}
- else if (strchr (gdb_completer_word_break_characters, *scan))
+ else if (strchr (breakchars, *scan))
{
break;
}
}
+
return (scan);
}
+/* Skip over the possibly quoted word STR (as defined by the quote
+ characters and word break characters used by the completer).
+ Returns pointer to the location after the "word". */
+
+char *
+skip_quoted (char *str)
+{
+ return skip_quoted_chars (str, NULL, NULL);
+}
diff --git a/gdb/completer.h b/gdb/completer.h
index 98b9ed8..b036231 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -39,6 +39,8 @@ extern char *get_gdb_completer_quote_characters (void);
/* Exported to linespec.c */
-extern char *skip_quoted (char *str);
+extern char *skip_quoted_chars (char *, char *, char *);
+
+extern char *skip_quoted (char *);
#endif /* defined (COMPLETER_H) */