aboutsummaryrefslogtreecommitdiffstats
path: root/cfg.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-08 16:26:26 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-08 16:26:26 +0000
commit96f97ca49625e33381abca737f13a5cace139f63 (patch)
treebe92cbd024c7ec44efa84f89922cd99e1fabb4e4 /cfg.c
parent82c5b766363e22d0a416e91610617a60fca0fff2 (diff)
downloadlcd4linux-96f97ca49625e33381abca737f13a5cace139f63.tar.gz
[lcd4linux @ 2004-03-08 16:26:26 by reinelt]
re-introduced \nnn (octal) characters in strings text widgets can have a 'update' speed of 0 which means 'never' (may be used for static content) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@389 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'cfg.c')
-rw-r--r--cfg.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/cfg.c b/cfg.c
index 0b4aec7..a39fbf4 100644
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.37 2004/03/06 20:31:16 reinelt Exp $^
+/* $Id: cfg.c,v 1.38 2004/03/08 16:26:26 reinelt Exp $^
*
* config file stuff
*
@@ -23,6 +23,11 @@
*
*
* $Log: cfg.c,v $
+ * Revision 1.38 2004/03/08 16:26:26 reinelt
+ * re-introduced \nnn (octal) characters in strings
+ * text widgets can have a 'update' speed of 0 which means 'never'
+ * (may be used for static content)
+ *
* Revision 1.37 2004/03/06 20:31:16 reinelt
* Complete rewrite of the evaluator to get rid of the code
* from mark Morley (because of license issues).
@@ -307,14 +312,33 @@ static char *strip (char *s, int strip_comments)
// unquote a string
static char *dequote (char *string)
{
- char *s=string;
- char *p=string;
+ int quote=0;
+ char *s = string;
+ char *p = string;
do {
- if (*s=='\\' && *(s+1)=='#') {
- *p++=*++s;
- } else {
- *p++=*s;
+ if (*s == '\'') {
+ quote = !quote;
+ *p++ = *s;
+ }
+ else if (quote && *s == '\\') {
+ s++;
+ if (*s >= '0' && *s <= '7') {
+ int n;
+ unsigned int c = 0;
+ sscanf (s, "%3o%n", &c, &n);
+ if (c == 0 || c > 255) {
+ error ("WARNING: illegal '\\' in <%s>", string);
+ } else {
+ *p++ = c;
+ s += n-1;
+ }
+ } else {
+ *p++ = *s;
+ }
+ }
+ else {
+ *p++ = *s;
}
} while (*s++);