From nobody Tue Sep 12 16:42:55 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RlTsX29DKz4stMf; Tue, 12 Sep 2023 16:42:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RlTsW63hhz3bYY; Tue, 12 Sep 2023 16:42:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694536975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJV4JOfBuK0cfiSOyMQ1KagOb8YhOs04tAkNhQosFNg=; b=wU5S1cp/Tbz6/0m10nR31XxGfnUTeqC0z74MXZP1gJ9Vqr/Ai/y8/yl+TGgKGYrhZTcalU WnyStJl2/zo5/fK7/I9i7ZbyMc8WJXdUJ6WuQ644VQxRANmCgL5XaiSdq4gM2HHycPpMJC QTUH5Ed8/S7hh169NO8yjOTDg1uiMwlBxELMKaypuKrNuYSVMAUhRq0vhLbwfOaDtD39w/ i4iJAYMBM/3qd6BgZhM78V+tFL5znbh0zFGIqhxKUYhtZ1FgtGj+5rQML1Qodkt/uP6peU /zzdIl/t8rfboLlSHpOwxMZVI/MYQZ75IFnrriy+63ksl/jTUOKQKOkzzIMYRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694536975; a=rsa-sha256; cv=none; b=Llf8nbzXj+QmDSG2SuK5hfLU2/Lip/IRdEE7dtpRrctQ3x4r0YwZNfWp3rKqH40XdGgc69 k5Oo9UEfV9LOp09Ndsr9kG6R31MJ7Gm4C+BsBjfv7zYRG7g67UqBE3p1wY1gpP99pwQmbf lb4TjivBcRg1wxyMnif2YEVZKMD8eq2HOjKDacDM6Yri1qu/5bT8+Mj5pH6Xu7Jdghe3pt o08PW5Uuh/qEeKt3dKius9WTtu36KqiCpUm/mPsXkLoyd4ZETRkIUHEXxzzc0vSIjGy9aZ GW07ECp+l3/YmuE4Ds0+GIXR7/mazUCXprDSJIEJqqu6SOYvo4WbSBNepKqd3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694536975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJV4JOfBuK0cfiSOyMQ1KagOb8YhOs04tAkNhQosFNg=; b=GppAjTKK75geqIs5UA8DUkH2/t58rlSV/eLAmTxDdm4FIpAaIpi7Q2zSz+KKbfTsbM/soq Il/AZedAtEJ8FhJV7JArBtWQRl7btT845iitNS3y3OLPcsDSijWlqJf94/CuZyE0JwfX75 lxRBPz4XHvOd81J142nd/1plfRh9fVeE7+oqUzbPDN+Gh6D9UvbEPTE0ybw6wsgt+zg/ng yr/zcGR2YJ6R/VVALDBMg+zCcwLxRdRL//zSuo5YOdiFSIx4HUgRiOmcBG07l+JKoC7nDR MrWlpQ2TkKv/2n+KjH7wDa+yENRHJf9XphyhANqZXOyJP0GY/17AzgvzwDh9eQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RlTsW4rvGzg6n; Tue, 12 Sep 2023 16:42:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38CGgtDA070455; Tue, 12 Sep 2023 16:42:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38CGgtSu070452; Tue, 12 Sep 2023 16:42:55 GMT (envelope-from git) Date: Tue, 12 Sep 2023 16:42:55 GMT Message-Id: <202309121642.38CGgtSu070452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 0fd450e2895e - main - sh: tab-complete aliases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0fd450e2895e1f9085fbd361a2aad8421a16dc66 Auto-Submitted: auto-generated The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=0fd450e2895e1f9085fbd361a2aad8421a16dc66 commit 0fd450e2895e1f9085fbd361a2aad8421a16dc66 Author: Piotr Pawel Stefaniak AuthorDate: 2023-04-29 20:38:50 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2023-09-12 16:39:42 +0000 sh: tab-complete aliases Differential Revision: https://reviews.freebsd.org/D40619 --- bin/sh/histedit.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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) {