From nobody Thu Sep 01 17:11:20 2022 X-Original-To: dev-commits-src-main@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 4MJSHs0lqqz4b0gM; Thu, 1 Sep 2022 17:11:21 +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 4MJSHs0FvGz3VJQ; Thu, 1 Sep 2022 17:11:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662052281; 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=3YSXLszKab9sYi80cskdpg5tfy8Jtc//P/+ReuHFm9I=; b=WujWRQFNuQeVZd0bd1xgsRmgeezBH3B6IFs3+l+lxTBdJaXE+7MtZXvB3PhmiIYzUTZVGQ 3Ee5PoG0kv7H+eNF7q7gtcvIEeyWt/2U8H5LcGcxndazjQa5UvJUeo9Xx0xzAeRDHC50EE kVPfhHWkqc4bN2GP+OyV7QJ3FYDZ3Xx2iB6FGskxGPJ9rjJ+nPZ2a2gfARYerwhScWcyj2 8o1vT2ditjoBGdh7EIu2DcoXbM+VFI7YT4WBDaljV37xXxHH62itb9iubvYdzujHiMSWI+ lMfh90QZqQBWnMPD1G0mbCXuRXbsKXgIBiGIcxTYY1OH0sTKwVi6j+AIpVFGFw== 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 4MJSHr6TWYzXW4; Thu, 1 Sep 2022 17:11:20 +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 281HBKkW002616; Thu, 1 Sep 2022 17:11:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 281HBKWx002615; Thu, 1 Sep 2022 17:11:20 GMT (envelope-from git) Date: Thu, 1 Sep 2022 17:11:20 GMT Message-Id: <202209011711.281HBKWx002615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a5948d40ad06 - main - stand: Add interp_has_builtin_cmd to see if we have a command List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: a5948d40ad060140bf5b995f5409458a18ced0ce Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662052281; 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=3YSXLszKab9sYi80cskdpg5tfy8Jtc//P/+ReuHFm9I=; b=vrkOyhKw6oNiB8DfAlhfbY7uV7hRwO5+V61OPW9y4J6fT9oJUe3zDhXw8fYPdPKwtJrr/y x6uEHH+Okb8iJxkst4Cv25dKfUfPNqaoAOheOiRWiapmWJpTYGN3DUAS9oPfYWoBQqUmkq QlvcM2QTrYP2SsKJUtGqmG8M7AqXyfAf9ie8eMvS7RN1HoWKGyxxtTwM/hh6bi8WssvyJ7 upTgwqv+zGQ41hQt4K41dguDKAGhR/IV7fvSSq8ixuzW6ooYzGMjZtg66hPQIo0qTdaJuu nMFrDznnGta/aVwRxofuwC+yKOxZBl8Quj1bi5rQIgwhGzmPY69NhWyTeSJvpA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662052281; a=rsa-sha256; cv=none; b=ybCZ4M6zb0CsYwWFEAK6JaFW5Rg8ngP/C94h2mC0Q96ICoDxlJYM29mGWC66Kk8ndHxGYl 77jFpZKbcHf2T1wqjl7fUDIdFSPmf/VOHIuwzFmJLhFnWPxIAMWhv543VBLB9zVioi/+Y0 NfYR0Y/FLc1rD9kBY332wXB3x63UaUzN+i5lBnGAYH27NcC1rXgZ9XmqP2Zh4jpbQ/a8ND m1lvhVGZKVtIeAkD3WpMfP49xrMxK2d23n4o+IQ2Uda8sJ0+AQ7aWAJbANMV/gZhNF25wO ZH6bznUwKYudnDHlpVvCBFpWQ5thj7z/h+FLwRhb3RvmWHKyPYwpfa1/7cK0cA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a5948d40ad060140bf5b995f5409458a18ced0ce commit a5948d40ad060140bf5b995f5409458a18ced0ce Author: Warner Losh AuthorDate: 2022-09-01 17:06:01 +0000 Commit: Warner Losh CommitDate: 2022-09-01 17:08:19 +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 --- 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); +}