aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2004-04-25 16:35:37 +0000
committerkraxel <kraxel>2004-04-25 16:35:37 +0000
commit3a28add0b68757c7c929b959c5b5ce3c717f7525 (patch)
treea08c03ab56a51da09f70f2a136c124039bdfd140
parent9083db6b4b52f7ae1384c52fcb9288166578c18c (diff)
downloadfbida-3a28add0b68757c7c929b959c5b5ce3c717f7525.tar.gz
- fbi config stuff.
-rw-r--r--GNUmakefile1
-rw-r--r--fbi.c3
-rw-r--r--fbiconfig.c35
-rw-r--r--fbiconfig.h2
4 files changed, 41 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
index f7f86d9..471bd23 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -157,6 +157,7 @@ ida.o: Ida.ad.h logo.h
# object files
OBJS_FBI := \
fbi.o fbtools.o fs.o fb-gui.o desktop.o \
+ parseconfig.o fbiconfig.o \
jpegtools.o jpeg/transupp.o \
dither.o filter.o op.o
diff --git a/fbi.c b/fbi.c
index 3ea278a..c12de4a 100644
--- a/fbi.c
+++ b/fbi.c
@@ -40,6 +40,8 @@
#include "filter.h"
#include "desktop.h"
#include "list.h"
+#include "parseconfig.h"
+#include "fbiconfig.h"
#include "jpeg/transupp.h" /* Support routines for jpegtran */
#include "jpegtools.h"
@@ -1240,6 +1242,7 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBLIRC
lirc = lirc_fbi_init();
#endif
+ fbi_read_config();
setlocale(LC_ALL,"");
for (;;) {
diff --git a/fbiconfig.c b/fbiconfig.c
new file mode 100644
index 0000000..0d86860
--- /dev/null
+++ b/fbiconfig.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "parseconfig.h"
+#include "fbiconfig.h"
+
+static char *fbi_config = NULL;
+
+static void init_config(void)
+{
+ char *home;
+
+ home = getenv("HOME");
+ if (NULL == home)
+ return;
+
+ fbi_config = malloc(strlen(home) + 16);
+ sprintf(fbi_config,"%s/.fbirc", home);
+}
+
+void fbi_read_config(void)
+{
+ init_config();
+ if (fbi_config)
+ cfg_parse_file("config", fbi_config);
+}
+
+void fbi_write_config(void)
+{
+ if (fbi_config)
+ cfg_write_file("config", fbi_config);
+}
diff --git a/fbiconfig.h b/fbiconfig.h
new file mode 100644
index 0000000..ff99e7e
--- /dev/null
+++ b/fbiconfig.h
@@ -0,0 +1,2 @@
+void fbi_read_config(void);
+void fbi_write_config(void);