diff options
author | Piotr Pawel Stefaniak <pstef@FreeBSD.org> | 2023-04-29 20:38:50 +0000 |
---|---|---|
committer | Piotr Pawel Stefaniak <pstef@FreeBSD.org> | 2023-09-12 16:39:42 +0000 |
commit | 0fd450e2895e1f9085fbd361a2aad8421a16dc66 (patch) | |
tree | 7f7b482a5de32b927e9c97f17dd6e122d8148b95 /bin/sh/histedit.c | |
parent | 2fc4a84ed8288bd25be3de35d756f46ec7785030 (diff) | |
download | src-0fd450e2895e1f9085fbd361a2aad8421a16dc66.tar.gz src-0fd450e2895e1f9085fbd361a2aad8421a16dc66.zip |
sh: tab-complete aliases
Differential Revision: https://reviews.freebsd.org/D40619
Diffstat (limited to 'bin/sh/histedit.c')
-rw-r--r-- | bin/sh/histedit.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 3ca8a0bcefa7..0d40e1c9ec1a 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; /* * Editline and history functions (and glue). */ +#include "alias.h" #include "shell.h" #include "parser.h" #include "var.h" @@ -671,6 +672,14 @@ static char goto out; matches = rmatches; } + for (const struct alias *ap = NULL; (ap = iteralias(ap)) != NULL;) { + if (strncmp(ap->name, text, curpos) != 0) + continue; + rmatches = add_match(matches, ++i, &size, strdup(ap->name)); + if (rmatches == NULL) + goto out; + matches = rmatches; + } out: free(free_path); if (i == 0) { |