summaryrefslogtreecommitdiff
path: root/readline/histexpand.c
diff options
context:
space:
mode:
authorJason Molenda <jsm@bugshack.cygnus.com>1999-08-02 23:48:37 +0000
committerJason Molenda <jsm@bugshack.cygnus.com>1999-08-02 23:48:37 +0000
commit6da787a878c938e680f13808dee254beacefbd43 (patch)
tree7c7b4d4f6655b210e33ca51f656f4552c9326ed3 /readline/histexpand.c
parent1392c9fbbf6fe8811e5374356b7fdf3b389068ab (diff)
downloadgdb-6da787a878c938e680f13808dee254beacefbd43.tar.gz
import gdb-1999-08-02 snapshot
Diffstat (limited to 'readline/histexpand.c')
-rw-r--r--readline/histexpand.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/readline/histexpand.c b/readline/histexpand.c
index 0dc179ac7f6..392e6d38d9e 100644
--- a/readline/histexpand.c
+++ b/readline/histexpand.c
@@ -365,6 +365,10 @@ hist_error(s, start, current, errtype)
emsg = "unrecognized history modifier";
elen = 29;
break;
+ case NO_PREV_SUBST:
+ emsg = "no previous substitution";
+ elen = 24;
+ break;
default:
emsg = "unknown expansion error";
elen = 23;
@@ -654,15 +658,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
}
}
- /* If there is no lhs, the substitution can't succeed. */
- if (subst_lhs_len == 0)
- {
- *ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
- free (result);
- free (temp);
- return -1;
- }
-
FREE (subst_rhs);
subst_rhs = get_subst_pattern (string, &i, delimiter, 1, &subst_rhs_len);
@@ -674,6 +669,15 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
else
i += 2;
+ /* If there is no lhs, the substitution can't succeed. */
+ if (subst_lhs_len == 0)
+ {
+ *ret_string = hist_error (string, starting_index, i, NO_PREV_SUBST);
+ free (result);
+ free (temp);
+ return -1;
+ }
+
l_temp = strlen (temp);
/* Ignore impossible cases. */
if (subst_lhs_len > l_temp)