diff options
Diffstat (limited to 'glcddrivers')
-rw-r--r-- | glcddrivers/config.c | 9 | ||||
-rw-r--r-- | glcddrivers/config.h | 3 | ||||
-rw-r--r-- | glcddrivers/driver.c | 8 | ||||
-rw-r--r-- | glcddrivers/driver.h | 3 |
4 files changed, 21 insertions, 2 deletions
diff --git a/glcddrivers/config.c b/glcddrivers/config.c index ef88279..15338b6 100644 --- a/glcddrivers/config.c +++ b/glcddrivers/config.c @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users sourceforge net> */ #include <syslog.h> @@ -214,6 +215,12 @@ bool cConfig::Load(const std::string & filename) continue; if (line[0] == '[' && line[line.length() - 1] == ']') { + // no ':' in section names + if (line.substr(1, line.length() - 2).find(':') != std::string::npos) { + syslog(LOG_ERR, "Config error: section name may not contain a ':', erraneous line: '%s'\n", line.c_str()); + file.close(); + return false; + } if (!inSections) inSections = true; else diff --git a/glcddrivers/config.h b/glcddrivers/config.h index 8caa77e..1c744e8 100644 --- a/glcddrivers/config.h +++ b/glcddrivers/config.h @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users sourceforge net> */ #ifndef _GLCDDRIVERS_CONFIG_H_ diff --git a/glcddrivers/driver.c b/glcddrivers/driver.c index ffd6d6a..fadef72 100644 --- a/glcddrivers/driver.c +++ b/glcddrivers/driver.c @@ -39,6 +39,14 @@ cDriver::~cDriver(void) delete oldConfig; } +const std::string cDriver::ConfigName() { + return (config) ? config->name : ""; +} + +const std::string cDriver::DriverName() { + return (config) ? config->driver : ""; +} + //void cDriver::SetScreen(const unsigned char * data, int wid, int hgt, int lineSize) void cDriver::SetScreen(const uint32_t * data, int wid, int hgt) diff --git a/glcddrivers/driver.h b/glcddrivers/driver.h index 7f95afc..ca6980a 100644 --- a/glcddrivers/driver.h +++ b/glcddrivers/driver.h @@ -59,6 +59,9 @@ public: int Width() const { return width; } int Height() const { return height; } + + const std::string ConfigName(); + const std::string DriverName(); virtual int Init() { return 0; } virtual int DeInit() { return 0; } |