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