aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-11-29 23:22:32 +0000
committerPer Bothner <per@bothner.com>1995-11-29 23:22:32 +0000
commitf2ed3a80bbee4ea7e133c4b7ae56fcae3cf8699c (patch)
tree83652d24e8d99fc0395ad6e99c94141798b66bb3 /gdb/top.c
parentbadefd2800f5ee2dc6a0eef870771af9dc29bba7 (diff)
downloadgdb-f2ed3a80bbee4ea7e133c4b7ae56fcae3cf8699c.zip
gdb-f2ed3a80bbee4ea7e133c4b7ae56fcae3cf8699c.tar.gz
gdb-f2ed3a80bbee4ea7e133c4b7ae56fcae3cf8699c.tar.bz2
* top.c (command_line_input): Only strip out an initial #-comment.
Looking for internal comments is language-specific (breaks Scheme).
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 7f2c8a4..09db238 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2041,16 +2041,11 @@ command_line_input (prrompt, repeat, annotation_suffix)
/* If we just got an empty line, and that is supposed
to repeat the previous command, return the value in the
global buffer. */
- if (repeat)
- {
- if (p == linebuffer)
- return line;
- p1 = linebuffer;
- while (*p1 == ' ' || *p1 == '\t')
- p1++;
- if (!*p1)
- return line;
- }
+ if (repeat && p == linebuffer)
+ return line;
+ for (p1 = linebuffer; *p1 == ' ' || *p1 == '\t'; p1++) ;
+ if (repeat && !*p1)
+ return line;
*p = 0;
@@ -2065,36 +2060,8 @@ command_line_input (prrompt, repeat, annotation_suffix)
out the command and then later fetch it from the value history
and remove the '#'. The kill ring is probably better, but some
people are in the habit of commenting things out. */
- p1 = linebuffer;
- while ((c = *p1++) != '\0')
- {
- if (c == '"')
- while ((c = *p1++) != '"')
- {
- /* Make sure an escaped '"' doesn't make us think the string
- is ended. */
- if (c == '\\')
- parse_escape (&p1);
- if (c == '\0')
- break;
- }
- else if (c == '\'')
- while ((c = *p1++) != '\'')
- {
- /* Make sure an escaped '\'' doesn't make us think the string
- is ended. */
- if (c == '\\')
- parse_escape (&p1);
- if (c == '\0')
- break;
- }
- else if (c == '#')
- {
- /* Found a comment. */
- p1[-1] = '\0';
- break;
- }
- }
+ if (*p1 == '#')
+ *p1 = '\0'; /* Found a comment. */
/* Save into global buffer if appropriate. */
if (repeat)