From 946b7deef9b5910f0e89b36a6110b8d3c6ef5fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20H=C3=A5llberg?= Date: Thu, 1 Jan 2009 02:59:11 +0100 Subject: set better $TITLE when viewing help texts 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) { -- cgit v0.10.2