[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dash
Subject:    [PATCH 4/6] fc: don't require an argument
From:       наб <nabijaczleweli () nabijaczleweli ! xyz>
Date:       2023-02-07 19:33:38
Message-ID: ba7012f7f2cf644c79160b6f1361486d46d9cf9d.1675798292.git.nabijaczleweli () nabijaczleweli ! xyz
[Download RAW message or body]


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 <harald@gigawatt.nl>
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
-- 
2.30.2


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic