From patchwork Tue Feb 7 19:33:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?0L3QsNCx?= X-Patchwork-Id: 13132071 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 137D3C636D4 for ; Tue, 7 Feb 2023 19:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231772AbjBGTeD (ORCPT ); Tue, 7 Feb 2023 14:34:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232047AbjBGTdy (ORCPT ); Tue, 7 Feb 2023 14:33:54 -0500 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E00E3B670 for ; Tue, 7 Feb 2023 11:33:40 -0800 (PST) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id B426A942; Tue, 7 Feb 2023 20:33:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202211; t=1675798419; bh=LFLA99HyYUBNUwoTrehEu2zy8RwDT7JJG6bmJkWYQmk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=Vdq6uwNpj095FXg/1ZQNyvbD9fwBRapdeX5/MVfR+QSHO0V/M6XMuwZkgIRnXYdtf 17P1iUl7GG08tNdq8IicgYNdX94eojI3lgMH3+sx97B0zoeFbpmPf8K85lmeEerW0W KgIiPICPtiXjpskAbQUuABumcmWecJqXFKzwlyWWjBpUIG/00Jpm17cL+wnjxFw05G CtdgEy6m++lV/PECgi1r6h+Pr3DBa8g/Iu889w58saC4Z0K0JyD4AvnYRi4Bzdo3m6 aJ6R7Cd6mHcyiAPzbyKbm+LPV2N6wD6KSMD1ELEepn6LXqsJZmmSBu2x4bv2aHlt8b zCAHSjFxEInsQ== Date: Tue, 7 Feb 2023 20:33:38 +0100 From: =?utf-8?b?0L3QsNCx?= To: Harald van Dijk , dash@vger.kernel.org Subject: [PATCH 4/6] fc: don't require an argument 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 is already handled correctly (per POSIX) below: When the synopsis form with -s is used: If first is omitted, the previous command shall be used. For the synopsis forms without -s: If first and last are both omitted, the previous 16 commands shall be listed or the previous single command shall be edited (based on the -l option). Test log: $ ls autogen.sh ChangeLog ... $ id uid=1000(nabijaczleweli) gid=100(users) groups=100(users) $ who nabijaczleweli pts/2 2023-02-07 18:36 (192.168.1.109) $ fc 4 , who q nabijaczleweli pts/2 2023-02-07 18:36 (192.168.1.109) $ fc -l 1 ls 2 id 3 who 4 fc $ fc -s fc -l 1 ls 2 id 3 who 4 fc 5 fc -l Reported-by: Harald van Dijk Reported-in: https://marc.info/?l=dash&m=154707728009743&w=2 --- src/histedit.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/histedit.c b/src/histedit.c index 24631ca..f10e5ab 100644 --- a/src/histedit.c +++ b/src/histedit.c @@ -212,9 +212,6 @@ histcmd(int argc, char **argv) if (hist == NULL) sh_error("history not active"); - if (argc == 1) - sh_error("missing history argument"); - #ifdef __GLIBC__ optind = 0; #else