From patchwork Wed Jan 4 11:35:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?0L3QsNCx?= X-Patchwork-Id: 13088501 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 889ADC4332F for ; Wed, 4 Jan 2023 11:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234871AbjADLfQ (ORCPT ); Wed, 4 Jan 2023 06:35:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbjADLfP (ORCPT ); Wed, 4 Jan 2023 06:35:15 -0500 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D7D2EAF for ; Wed, 4 Jan 2023 03:35:15 -0800 (PST) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 6B299652; Wed, 4 Jan 2023 12:35:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202211; t=1672832114; bh=JIvJ+jmIdHcZ41bhPHwL9sdN33SD7wo41BhW/RjdjHQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eKN7PFTBhP59dOgbTxNzXlhzmmg8yJD2otl85/uicy8xF4WOczkiUHuNn+30FV/in D5Und+P2iItzWiOrIAIfR5CpdXxNVf+imhYT3xPiLW38/FgOkHDyOSDNv6lsucmn+x sGu0TjVwkp26ZvW5vVWpZTfpnsrs02nWxNGmNQpa67UhqB2wMGh7ZNt7wOLeFs8qD6 hOCPC7VsHJrjMVLEB0ZoUduD7hmmWEbi3xRL4iTYhOlYT4/6S/6Qwsz3UHuYKGDK0x 1xZ7EJfz+fZkv3MzZC/hfDKrrM6NVm37fSfMRCa6LvPxmZA358XYXDH0scjb51qVBQ 2cwVf+FVr0JvA== Date: Wed, 4 Jan 2023 12:35:13 +0100 From: =?utf-8?b?0L3QsNCx?= To: Herbert Xu Cc: dash@vger.kernel.org Subject: [PATCH v2 2/2] exec: type: ignore first -- for consistency Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20220429 Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org This appears to be the only remaining built-in that doesn't use nextopt() to parse its arguments (and isn't forbidden from doing so) ‒ users expect to be able to do this, and it's nice to be consistent here. Test with: type -- ls -- Correct output lists ls=/bin/ls, then --=ENOENT Wrong output lists --=ENOENT, ls=/bin/ls, --=ENOENT Fixes: https://bugs.debian.org/870317 --- src/exec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/exec.c b/src/exec.c index 87354d4..d61881d 100644 --- a/src/exec.c +++ b/src/exec.c @@ -760,11 +760,11 @@ unsetfunc(const char *name) int typecmd(int argc, char **argv) { - int i; int err = 0; - for (i = 1; i < argc; i++) { - err |= describe_command(out1, argv[i], NULL, 1); + nextopt(nullstr); + while (*argptr) { + err |= describe_command(out1, *argptr++, NULL, 1); } return err; }