From nobody Tue Jan 24 22:12:18 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 4P1h6C2VHtz3bfZD; Tue, 24 Jan 2023 22:12:19 +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 4P1h6C1sMjz3CXw; Tue, 24 Jan 2023 22:12:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598339; 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=2lU/rQcjP4OcPlB6cbtCXzzHA/hJlQKV3Nt0RFVgsI8=; b=lshqXKUb3GCvQ9dn8zxrceqhp2HlX9rtyg/uacimiCIxb4cQB5XKNjpV7sFf/9hGl9mTfL JUwlAxvvaVxcm5fKp+Jz/dH3sioTk7OOx5am32GXyqa8liCCf7+fAAgwXxLYFphihAj+uv 4T32ARget7R1aXECs1MCKwd0r/JRgQw+ozMW24p2WAPP34tu6MUBrg3Y+PgfKEdWwb16EY WLC9sZFz4H/v4fAHDhBc/dwcW8TFsGC4tD0bJBAVzDufSPpAiW9K5QYna7gNQdvB3mSb0A vdnMVBuJG2sCck30QfTr1HYuhREuRp9zslqP8ASN1z0FpLU9fEB7FK05f8QH7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598339; 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=2lU/rQcjP4OcPlB6cbtCXzzHA/hJlQKV3Nt0RFVgsI8=; b=KlGjyOk8d8xE5PHFJ4RiANHWnBur8zwhxdMt4L1pE8PrZrN+AKPTIHKNCh0oTfDaHuOlkA PphRmMlwBmSez8OS+1CkTlyHAJNtAV4AtUMMhv8coWqUp5eK9pT3fdLrc4sve7tTdJtEik /JTMe9LEDhsbS4tOvgI7kVyXdiIzFO1z37nA3Z4VvRmnov5UQDoHDDHH/rbkzodBECJ5vD o0+iYkHIBAMoo54ltpGMCYx7rD9dfUBgcOYjpvKFSlsCkeYGeK8KDcUPRxyRY4xNnw3MwD Adb0FsWu39/aVRHH9lsoGOd5SH5CEWJ/y337vMKcDyce/KrmC4dLI4zzBXYMXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598339; a=rsa-sha256; cv=none; b=BL6Gp+6ZRcF+9C0bq7k7uJ2kqBU+mHf5XW4bgCZMrvqUqMZ2F1lO1q6Hi6GRgE+/AqBO6O bl/l2NcuUnHqE2JBxcTVFWncyHNT35YlyPEWQ3wuJLrSW4Dbjw8MqgSTsAsEZzoNlfpseD TBAOHMwYhAPl2/U/q8Lneq0rkHUZkWntXfpYzCJsbAxSfGQMeFkPLbgbLVZyRx4jJ4WIcU DtTjGmkiQXacfOmobd/4/18Yb6j+LVxvgmzO9EohzVpszlInvuAnP0TcI+aseV4qhUXfnT nkSV+NAiQer/TuglVrbzBLjBmwLY3uxPz8D2wW9RZVz/qEjjnrRTgaEkUWxDCQ== 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 4P1h6C0dYlzQgM; Tue, 24 Jan 2023 22:12:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30OMCItA086854; Tue, 24 Jan 2023 22:12:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMCIiH086853; Tue, 24 Jan 2023 22:12:18 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:12:18 GMT Message-Id: <202301242212.30OMCIiH086853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 6617245b33af - stable/13 - stand: Add interp_has_builtin_cmd to see if we have a command 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6617245b33afca26c8961a92999130faa51d2c19 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6617245b33afca26c8961a92999130faa51d2c19 commit 6617245b33afca26c8961a92999130faa51d2c19 Author: Warner Losh AuthorDate: 2022-09-01 17:06:01 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:32 +0000 stand: Add interp_has_builtin_cmd to see if we have a command interp_has_builtin_cmd() will try to lookup the passed in command and returns true if it was found, false otherwise. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36364 (cherry picked from commit a5948d40ad060140bf5b995f5409458a18ced0ce) --- stand/common/bootstrap.h | 1 + stand/common/interp.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index 9c62a49b0da7..cb1c96dc3b69 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -52,6 +52,7 @@ extern char command_errbuf[COMMAND_ERRBUFSZ]; void interact(void); void interp_emit_prompt(void); int interp_builtin_cmd(int argc, char *argv[]); +bool interp_has_builtin_cmd(const char *cmd); /* Called by interp.c for interp_*.c embedded interpreters */ int interp_include(const char *); /* Execute commands from filename */ diff --git a/stand/common/interp.c b/stand/common/interp.c index 227e7ad91e29..8b779fb7a5e9 100644 --- a/stand/common/interp.c +++ b/stand/common/interp.c @@ -190,3 +190,12 @@ interp_builtin_cmd(int argc, char *argv[]) } return (result); } + +/* + * Return true if the builtin command exists + */ +bool +interp_has_builtin_cmd(const char *cmd) +{ + return (interp_lookup_cmd(cmd) != NULL); +}