aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cmd.c b/cmd.c
index 48e72c0..e633b5f 100644
--- a/cmd.c
+++ b/cmd.c
@@ -432,11 +432,14 @@ static void cmd_help __P1 (char *,arg)
fclose(f);
return;
}
-
- memcpy(text, line, i = strlen(line));
- while (fgets(line, BUFSIZE, f) && line[0] == '@')
- ; /* allow multiple commands to share the same help */
+ /* the first line becomes $TITLE */
+ tmp = strchr(line, '\n');
+ if (tmp) *tmp = '\0';
+ i = sprintf(text, "Help on '%s'\n", line + 1);
+
+ /* allow multiple commands to share the same help */
+ while (fgets(line, BUFSIZE, f) && line[0] == '@') ;
do {
if ((len = strlen(line)) >= size - i) {