summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/svdrp.c b/svdrp.c
index c5a71cdb..3115349c 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.41 2002/09/04 10:49:42 kls Exp $
+ * $Id: svdrp.c 1.42 2002/09/08 11:22:57 kls Exp $
*/
#include "svdrp.h"
@@ -387,6 +387,7 @@ void cSVDRP::CmdCHAN(const char *Option)
{
if (*Option) {
int n = -1;
+ int d = 0;
if (isnumber(Option)) {
int o = strtol(Option, NULL, 10);
if (o >= 1 && o <= Channels.MaxNumber())
@@ -394,13 +395,17 @@ void cSVDRP::CmdCHAN(const char *Option)
}
else if (strcmp(Option, "-") == 0) {
n = cDevice::CurrentChannel();
- if (n > 1)
+ if (n > 1) {
n--;
+ d = -1;
+ }
}
else if (strcmp(Option, "+") == 0) {
n = cDevice::CurrentChannel();
- if (n < Channels.MaxNumber())
+ if (n < Channels.MaxNumber()) {
n++;
+ d = 1;
+ }
}
else {
int i = 1;
@@ -417,17 +422,21 @@ void cSVDRP::CmdCHAN(const char *Option)
Reply(501, "Undefined channel \"%s\"", Option);
return;
}
- cChannel *channel = Channels.GetByNumber(n);
- if (channel) {
- if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
- Reply(554, "Error switching to channel \"%d\"", channel->number);
+ if (!d) {
+ cChannel *channel = Channels.GetByNumber(n);
+ if (channel) {
+ if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
+ Reply(554, "Error switching to channel \"%d\"", channel->number);
+ return;
+ }
+ }
+ else {
+ Reply(550, "Unable to find channel \"%s\"", Option);
return;
}
}
- else {
- Reply(550, "Unable to find channel \"%s\"", Option);
- return;
- }
+ else
+ cDevice::SwitchChannel(d);
}
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel)