summaryrefslogtreecommitdiffstats
path: root/contrib/libreadline/histexpand.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1999-05-28 01:59:23 +0000
committerache <ache@FreeBSD.org>1999-05-28 01:59:23 +0000
commit2fbece35f71145c1c63d12046e54a9c059114d69 (patch)
treeb727625e73f35f475e06719785a6f7a2d5126754 /contrib/libreadline/histexpand.c
parent27ef633cd3f7fd5fb6cb033edd2c1747a6e59acb (diff)
downloadFreeBSD-src-2fbece35f71145c1c63d12046e54a9c059114d69.zip
FreeBSD-src-2fbece35f71145c1c63d12046e54a9c059114d69.tar.gz
readline v4.0
Diffstat (limited to 'contrib/libreadline/histexpand.c')
-rw-r--r--contrib/libreadline/histexpand.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/contrib/libreadline/histexpand.c b/contrib/libreadline/histexpand.c
index 0dc179a..392e6d3 100644
--- a/contrib/libreadline/histexpand.c
+++ b/contrib/libreadline/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)
OpenPOWER on IntegriCloud