From fae6bae6d47b5bf9328627cad851be6a227fd982 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 1 Apr 2001 16:07:58 +0200 Subject: The SVDRP HELP command now prints the topics in several columns --- HISTORY | 1 + svdrp.c | 21 ++++++++++++++++----- 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"); } -- cgit v1.2.3