diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2000-12-28 12:57:16 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2000-12-28 12:57:16 +0100 |
commit | 4e354bc9a0f9a67e842932b1de9da889488c8a2b (patch) | |
tree | a07ad700367cef6a4058aecb6e6e47549c4fb9ed /config.h | |
parent | be137ee37f0e9f6f9a90b3c57922b7d65fbde5d2 (diff) | |
download | vdr-4e354bc9a0f9a67e842932b1de9da889488c8a2b.tar.gz vdr-4e354bc9a0f9a67e842932b1de9da889488c8a2b.tar.bz2 |
Implemented 'on disk editing'
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 59 |
1 files changed, 36 insertions, 23 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.35 2000/12/08 13:57:23 kls Exp $ + * $Id: config.h 1.36 2000/12/25 14:20:09 kls Exp $ */ #ifndef __CONFIG_H @@ -14,6 +14,7 @@ #include <stdio.h> #include <string.h> #include <time.h> +#include <unistd.h> #include "dvbapi.h" #include "eit.h" #include "tools.h" @@ -42,6 +43,15 @@ enum eKeys { // "Up" and "Down" must be the first two keys! k_Flags = k_Repeat | k_Release, }; +// This is in preparation for having more key codes: +#define kMarkToggle k0 +#define kMarkMoveBack k4 +#define kMarkMoveForward k6 +#define kMarkJumpBack k7 +#define kMarkJumpForward k9 +#define kEditCut k2 +#define kEditTest k8 + #define RAWKEY(k) ((k) & ~k_Flags) #define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0) #define NORMALKEY(k) ((k) & ~k_Repeat) @@ -157,33 +167,36 @@ private: cList<T>::Clear(); } public: + cConfig(void) { fileName = NULL; } + virtual ~cConfig() { delete fileName; } virtual bool Load(const char *FileName) { - isyslog(LOG_INFO, "loading %s", FileName); - bool result = true; Clear(); fileName = strdup(FileName); - FILE *f = fopen(fileName, "r"); - if (f) { - int line = 0; - char buffer[MaxBuffer]; - while (fgets(buffer, sizeof(buffer), f) > 0) { - line++; - T *l = new T; - if (l->Parse(buffer)) - Add(l); - else { - esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line); - delete l; - result = false; - break; + bool result = false; + if (access(FileName, F_OK) == 0) { + isyslog(LOG_INFO, "loading %s", FileName); + FILE *f = fopen(fileName, "r"); + if (f) { + int line = 0; + char buffer[MaxBuffer]; + result = true; + while (fgets(buffer, sizeof(buffer), f) > 0) { + line++; + T *l = new T; + if (l->Parse(buffer)) + Add(l); + else { + esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line); + delete l; + result = false; + break; + } } - } - fclose(f); - } - else { - LOG_ERROR_STR(fileName); - result = false; + fclose(f); + } + else + LOG_ERROR_STR(fileName); } return result; } |