aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorGustav HÃ¥llberg <gustav@gmail.com>2009-01-01 01:59:11 (GMT)
committerGustav HÃ¥llberg <gustav@gmail.com>2009-01-16 23:38:32 (GMT)
commit946b7deef9b5910f0e89b36a6110b8d3c6ef5fd4 (patch)
treeaab106555ff8bfad4fdbc3227740edaee8d7d02d /cmd.c
parent05209528cad427d4df322bde20f1662196e762e4 (diff)
downloadpowwow-946b7deef9b5910f0e89b36a6110b8d3c6ef5fd4.zip
powwow-946b7deef9b5910f0e89b36a6110b8d3c6ef5fd4.tar.gz
powwow-946b7deef9b5910f0e89b36a6110b8d3c6ef5fd4.tar.bz2
set better $TITLE when viewing help texts
Diffstat (limited to 'cmd.c')
-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) {