diff mbox series

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

Message ID ba7012f7f2cf644c79160b6f1361486d46d9cf9d.1675798292.git.nabijaczleweli@nabijaczleweli.xyz (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [1/6] fc -s: refuse multiple events instead of ignoring | expand

Commit Message

наб Feb. 7, 2023, 7:33 p.m. UTC
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 mbox series

Patch

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