aboutsummaryrefslogtreecommitdiffstats
path: root/cfg.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2000-03-26 20:00:44 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2000-03-26 20:00:44 +0000
commit42914eda641c23996f9328c67fddb13df6225fb2 (patch)
tree25824500dce2923467adfa6a32a64f57049e15c2 /cfg.c
parent9660f76b9498ca64ff2c0d3372ff6ce7d4a92090 (diff)
downloadlcd4linux-42914eda641c23996f9328c67fddb13df6225fb2.tar.gz
[lcd4linux @ 2000-03-26 20:00:44 by reinelt]
README.Raster added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@24 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'cfg.c')
-rw-r--r--cfg.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/cfg.c b/cfg.c
index 1e0df08..fcb9651 100644
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.3 2000/03/26 19:03:52 reinelt Exp $
+/* $Id: cfg.c,v 1.4 2000/03/26 20:00:44 reinelt Exp $
*
* config file stuff
*
@@ -20,6 +20,10 @@
*
*
* $Log: cfg.c,v $
+ * Revision 1.4 2000/03/26 20:00:44 reinelt
+ *
+ * README.Raster added
+ *
* Revision 1.3 2000/03/26 19:03:52 reinelt
*
* more Pixmap renaming
@@ -89,7 +93,6 @@ static char *strip (char *s)
for (p=s; *p; p++) {
if (*p=='"') do p++; while (*p && *p!='\n' && *p!='"');
if (*p=='\'') do p++; while (*p && *p!='\n' && *p!='\'');
- if (p>s && *(p-1)=='\\' && *p=='#')
if (*p=='\n' || (*p=='#' && (p==s || *(p-1)!='\\'))) {
*p='\0';
break;
@@ -99,6 +102,17 @@ static char *strip (char *s)
return s;
}
+static char *dequote (char *string)
+{
+ char *s=string;
+ char *p=string;
+
+ do {
+ if (*s!='\\') *p++=*s;
+ } while (*s++);
+
+ return string;
+}
void cfg_set (char *key, char *val)
{
@@ -107,17 +121,16 @@ void cfg_set (char *key, char *val)
for (i=0; i<nConfig; i++) {
if (strcasecmp(Config[i].key, key)==0) {
if (Config[i].val) free (Config[i].val);
- Config[i].val=strdup(val);
+ Config[i].val=dequote(strdup(val));
return;
}
}
nConfig++;
Config=realloc(Config, nConfig*sizeof(ENTRY));
Config[i].key=strdup(key);
- Config[i].val=strdup(val);
+ Config[i].val=dequote(strdup(val));
}
-
char *cfg_get (char *key)
{
int i;
@@ -130,7 +143,6 @@ char *cfg_get (char *key)
return NULL;
}
-
int cfg_read (char *file)
{
FILE *stream;
@@ -171,7 +183,6 @@ int cfg_read (char *file)
return 0;
}
-
char *cfg_file (void)
{
if (Config_File)