bug-bash
[Top][All Lists]
Advanced

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

[PATCH] help -d: print loadable builtins correctly


From: Grisha Levit
Subject: [PATCH] help -d: print loadable builtins correctly
Date: Thu, 3 Oct 2024 22:16:11 -0400

help -d output assumes that long_doc[0] includes a newline, which is
not the case for loadable builtins:

    $ enable ln rm
    $ help -d ln rm
    ln - Link files.rm - Remove files
---
 builtins/help.def | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/builtins/help.def b/builtins/help.def
index 770ded01..3277ccf5 100644
--- a/builtins/help.def
+++ b/builtins/help.def
@@ -265,13 +265,10 @@ show_desc (char *name, int i)
     line = doc ? doc[0] : (char *)NULL;
 
   printf ("%s - ", name);
-  for (j = 0; line && line[j]; j++)
-    {
-      putchar (line[j]);
-      if (line[j] == '\n')
-       break;
-    }
-  
+  for (j = 0; line && line[j] && line[j] != '\n'; j++)
+    putchar (line[j]);
+  putchar ('\n');
+
   fflush (stdout);
 
   if (usefile)
-- 
2.46.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]