Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
VDR-0.68 fix for programme labels with ':'
Hi folks,
this is a backward compatible patch against config.c of VDR-0.68 to fix
the problem with ':' in programme labels. You now can use ':' or '|' or
TABs as delimiters.
Deti
--
Deti Fliegl
Phone: +49 179 2198419 Fax: +49-1805-05255556258
e-mailto:deti@fliegl.de http://www.fliegl.de
[ Part 2: "Attached Text" ]
--- VDR/config.c Sat Nov 18 14:26:36 2000
+++ VDR-0.68/config.c Sun Nov 19 22:08:30 2000
@@ -207,17 +207,12 @@
const char *cChannel::ToText(cChannel *Channel)
{
- char buf[MaxChannelName * 2];
char *s = Channel->name;
- if (strchr(s, ':')) {
- s = strcpy(buf, s);
- strreplace(s, ':', '|');
- }
delete buffer;
if (Channel->groupSep)
- asprintf(&buffer, ":%s\n", s);
+ asprintf(&buffer, "\t%s\n", s);
else
- asprintf(&buffer, "%s:%d:%c:%d:%d:%d:%d:%d:%d\n", s, Channel->frequency, Channel->polarization, Channel->diseqc, Channel->srate, Channel->vpid, Channel->apid, Channel->ca, Channel->pnr);
+ asprintf(&buffer, "%s\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d\n", s, Channel->frequency, Channel->polarization, Channel->diseqc, Channel->srate, Channel->vpid, Channel->apid, Channel->ca, Channel->pnr);
return buffer;
}
@@ -229,7 +224,7 @@
bool cChannel::Parse(const char *s)
{
char *buffer = NULL;
- if (*s == ':') {
+ if (*s == '\t' || *s ==':' ) {
if (*++s) {
strn0cpy(name, s, MaxChannelName);
name[strlen(name) - 1] = 0; // strip the '\n'
@@ -240,7 +235,11 @@
}
else {
groupSep = false;
- int fields = sscanf(s, "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
+ int fields = sscanf(s, "%a[^\t]\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
+ if(fields!=9)
+ fields = sscanf(s, "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
+ if(fields!=9)
+ fields = sscanf(s, "%a[^|]|%d|%c|%d|%d|%d|%d|%d|%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apid, &ca, &pnr);
if (fields == 9) {
strn0cpy(name, buffer, MaxChannelName);
delete buffer;
@@ -248,7 +247,6 @@
else
return false;
}
- strreplace(name, '|', ':');
return true;
}
Home |
Main Index |
Thread Index