diff --git a/Fixes b/Fixes index 16c56142..7b5c6837 100644 --- a/Fixes +++ b/Fixes @@ -1,3 +1,4 @@ + 38. Recognize history searches in history expansion !?foo (christos) 37. V6.24.13 - 2024-06-12 36. Fix !^:h and !^:t failing when no / found (Kimmo Suominen) 35. Add cross-build support for gethost (josefs10) diff --git a/ed.chared.c b/ed.chared.c index b016ad9c..8507c59e 100644 --- a/ed.chared.c +++ b/ed.chared.c @@ -490,6 +490,16 @@ c_expand(Char *p) buf = expand_lex(&h->Hlex, 1, INT_MAX); break; + case '?': + h = findev(p + 2, 1); + if (h == NULL) + goto excl_err; + buf = expand_lex(&h->Hlex, 0, INT_MAX); + while (*q) + q++; + q--; + break; + default: if (been_once) { /* unknown argument */ /* assume it's a modifier, e.g. !foo:h, and get whole cmd */ diff --git a/sh.decls.h b/sh.decls.h index a863fede..5b5326cb 100644 --- a/sh.decls.h +++ b/sh.decls.h @@ -240,6 +240,7 @@ extern void btoeof (void); extern void copylex (struct wordent *, struct wordent *); extern Char *domod (Char *, Char); extern void initlex (struct wordent *); +struct Hist *findev (Char *, int); extern void freelex (struct wordent *); extern int lex (struct wordent *); extern void lex_cleanup (void *); diff --git a/sh.lex.c b/sh.lex.c index a1d3d4a5..bc2d07f7 100644 --- a/sh.lex.c +++ b/sh.lex.c @@ -51,7 +51,6 @@ static Char *word (int); static eChar getC1 (int); static void getdol (void); static void getexcl (Char); -static struct Hist *findev (Char *, int); static void setexclp (Char *); static eChar bgetc (void); static void balloc (int); @@ -1313,7 +1312,7 @@ gethent(Char sc) return (0); } -static struct Hist * +struct Hist * findev(Char *cp, int anyarg) { struct Hist *hp;