summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-04-01 16:07:58 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-04-01 16:07:58 +0200
commitfae6bae6d47b5bf9328627cad851be6a227fd982 (patch)
tree45ef5d5b62140815601eed0c4d7cd13e1c9dc816
parentf1fce1393827ac71875e2b4192e3496ef421dbbb (diff)
downloadvdr-fae6bae6d47b5bf9328627cad851be6a227fd982.tar.gz
vdr-fae6bae6d47b5bf9328627cad851be6a227fd982.tar.bz2
The SVDRP HELP command now prints the topics in several columns0.7.2
-rw-r--r--HISTORY1
-rw-r--r--svdrp.c21
2 files changed, 17 insertions, 5 deletions
diff --git a/HISTORY b/HISTORY
index 2906fa33..203377d3 100644
--- a/HISTORY
+++ b/HISTORY
@@ -451,3 +451,4 @@ Video Disk Recorder Revision History
Windows 'telnet').
- Empty lines in config files no longer cause error messages.
- New SVDRP command LSTE to list the EPG data.
+- The SVDRP HELP command now prints the topics in several columns.
diff --git a/svdrp.c b/svdrp.c
index cd4a143d..df4ffacc 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.17 2001/04/01 15:38:49 kls Exp $
+ * $Id: svdrp.c 1.18 2001/04/01 16:06:54 kls Exp $
*/
#define _GNU_SOURCE
@@ -473,13 +473,24 @@ void cSVDRP::CmdHELP(const char *Option)
Reply(-214, "This is VDR version %s", VDRVERSION);
Reply(-214, "Topics:");
const char **hp = HelpPages;
+ int NumPages = 0;
while (*hp) {
- //TODO multi-column???
- const char *topic = GetHelpTopic(*hp);
- if (topic)
- Reply(-214, " %s", topic);
+ NumPages++;
hp++;
}
+ const int TopicsPerLine = 5;
+ int x = 0;
+ for (int y = 0; (y * TopicsPerLine + x) < NumPages; y++) {
+ char buffer[TopicsPerLine * (MAXHELPTOPIC + 5)];
+ char *q = buffer;
+ for (x = 0; x < TopicsPerLine && (y * TopicsPerLine + x) < NumPages; x++) {
+ const char *topic = GetHelpTopic(HelpPages[(y * TopicsPerLine + x)]);
+ if (topic)
+ q += sprintf(q, " %s", topic);
+ }
+ x = 0;
+ Reply(-214, buffer);
+ }
Reply(-214, "To report bugs in the implementation send email to");
Reply(-214, " vdr-bugs@cadsoft.de");
}