X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=readline%2Fhistexpand.c;h=392e6d38d9ec771b77019df9272fa42c62d9f22f;hb=27e232885db363fb545fd2f450e72d929e59b8f6;hp=0dc179ac7f6590cd9557793610998d194d1b3c4d;hpb=d60d9f651ab04df95fcd31488fbb46be263382ae;p=deliverable%2Fbinutils-gdb.git diff --git a/readline/histexpand.c b/readline/histexpand.c index 0dc179ac7f..392e6d38d9 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)