[PATCH 4/6] fc: don't require an argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux