aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BeckmannEgle.c9
-rw-r--r--Crystalfontz.c9
-rw-r--r--Cwlinux.c9
-rw-r--r--HD44780.c13
-rw-r--r--M50530.c9
-rw-r--r--Makefile.am27
-rw-r--r--Makefile.in12
-rw-r--r--MatrixOrbital.c11
-rw-r--r--PalmPilot.c9
-rw-r--r--Raster.c7
-rw-r--r--SIN.c7
-rw-r--r--Text.c9
-rw-r--r--USBLCD.c9
-rw-r--r--cfg.c52
-rw-r--r--cfg.h19
-rw-r--r--debug.c19
-rw-r--r--debug.h9
-rw-r--r--display.c10
-rw-r--r--display.h11
-rw-r--r--icon.c11
-rw-r--r--lcd4linux.c35
-rw-r--r--parport.c13
-rw-r--r--processor.c13
-rw-r--r--seti.c9
-rw-r--r--system.c7
25 files changed, 217 insertions, 131 deletions
diff --git a/BeckmannEgle.c b/BeckmannEgle.c
index 21504d7..622dcb6 100644
--- a/BeckmannEgle.c
+++ b/BeckmannEgle.c
@@ -1,4 +1,4 @@
-/* $Id: BeckmannEgle.c,v 1.14 2003/08/16 07:31:35 reinelt Exp $
+/* $Id: BeckmannEgle.c,v 1.15 2003/08/24 05:17:58 reinelt Exp $
*
* driver for Beckmann+Egle mini terminals
*
@@ -20,6 +20,9 @@
*
*
* $Log: BeckmannEgle.c,v $
+ * Revision 1.15 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.14 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
@@ -229,14 +232,14 @@ int BE_init (LCD *Self)
port=cfg_get ("Port", NULL);
if (port==NULL || *port=='\0') {
- error ("BeckmannEgle: no 'Port' entry in %s", cfg_file());
+ error ("BeckmannEgle: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
s=cfg_get("Type", NULL);
if (s==NULL || *s=='\0') {
- error ("BeckmannEgle: no 'Type' entry in %s", cfg_file());
+ error ("BeckmannEgle: no 'Type' entry in %s", cfg_source());
return -1;
}
if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
diff --git a/Crystalfontz.c b/Crystalfontz.c
index 628abe0..8e11d35 100644
--- a/Crystalfontz.c
+++ b/Crystalfontz.c
@@ -1,4 +1,4 @@
-/* $Id: Crystalfontz.c,v 1.12 2003/08/19 04:28:41 reinelt Exp $
+/* $Id: Crystalfontz.c,v 1.13 2003/08/24 05:17:58 reinelt Exp $
*
* driver for display modules from Crystalfontz
*
@@ -19,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: Crystalfontz.c,v $
+ * Revision 1.13 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.12 2003/08/19 04:28:41 reinelt
* more Icon stuff, minor glitches fixed
*
@@ -208,7 +211,7 @@ static int CF_init (LCD *Self)
port=cfg_get ("Port",NULL);
if (port==NULL || *port=='\0') {
- error ("Crystalfontz: no 'Port' entry in %s", cfg_file());
+ error ("Crystalfontz: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
@@ -229,7 +232,7 @@ static int CF_init (LCD *Self)
Speed=B19200;
break;
default:
- error ("Crystalfontz: unsupported speed '%s' in %s", speed, cfg_file());
+ error ("Crystalfontz: unsupported speed '%s' in %s", speed, cfg_source());
return -1;
}
diff --git a/Cwlinux.c b/Cwlinux.c
index 4866a61..bd61317 100644
--- a/Cwlinux.c
+++ b/Cwlinux.c
@@ -1,4 +1,4 @@
-/* $Id: Cwlinux.c,v 1.11 2003/08/16 07:31:35 reinelt Exp $
+/* $Id: Cwlinux.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $
*
* driver for Cwlinux serial display modules
*
@@ -20,6 +20,9 @@
*
*
* $Log: Cwlinux.c,v $
+ * Revision 1.12 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.11 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
@@ -285,7 +288,7 @@ int CW_init(LCD * Self)
port = cfg_get("Port",NULL);
if (port == NULL || *port == '\0') {
- error("Cwlinux: no 'Port' entry in %s", cfg_file());
+ error("Cwlinux: no 'Port' entry in %s", cfg_source());
return -1;
}
Port = strdup(port);
@@ -300,7 +303,7 @@ int CW_init(LCD * Self)
Speed = B19200;
break;
default:
- error("Cwlinux: unsupported speed '%s' in %s", speed, cfg_file());
+ error("Cwlinux: unsupported speed '%s' in %s", speed, cfg_source());
return -1;
}
diff --git a/HD44780.c b/HD44780.c
index d4b27e4..5ba2358 100644
--- a/HD44780.c
+++ b/HD44780.c
@@ -1,4 +1,4 @@
-/* $Id: HD44780.c,v 1.35 2003/08/22 03:45:08 reinelt Exp $
+/* $Id: HD44780.c,v 1.36 2003/08/24 05:17:58 reinelt Exp $
*
* driver for display modules based on the HD44780 chip
*
@@ -27,6 +27,9 @@
*
*
* $Log: HD44780.c,v $
+ * Revision 1.36 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.35 2003/08/22 03:45:08 reinelt
* bug in parallel port code fixed, more icons stuff
*
@@ -401,7 +404,7 @@ int HD_init (LCD *Self)
s=cfg_get("Size",NULL);
if (s==NULL || *s=='\0') {
- error ("HD44780: no 'Size' entry in %s", cfg_file());
+ error ("HD44780: no 'Size' entry in %s", cfg_source());
return -1;
}
if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
@@ -416,7 +419,7 @@ int HD_init (LCD *Self)
else {
gpos=strtol(s, &e, 0);
if (*e!='\0' || gpos<0 || gpos>8) {
- error ("HD44780: bad GPOs '%s' in %s", s, cfg_file());
+ error ("HD44780: bad GPOs '%s' in %s", s, cfg_source());
return -1;
}
}
@@ -424,7 +427,7 @@ int HD_init (LCD *Self)
s=cfg_get("Controllers", "1");
Controllers=strtol(s, &e, 0);
if (*e!='\0' || Controllers<1 || Controllers>2) {
- error ("HD44780: bad Controllers '%s' in %s, should be '1' or '2'", s, cfg_file());
+ error ("HD44780: bad Controllers '%s' in %s, should be '1' or '2'", s, cfg_source());
return -1;
}
info ("wiring: using display with %d controllers", Controllers);
@@ -448,7 +451,7 @@ int HD_init (LCD *Self)
s=cfg_get("Bits", "8");
Bits=strtol(s, &e, 0);
if (*e!='\0' || (Bits!=4 && Bits!=8)) {
- error ("HD44780: bad Bits '%s' in %s, should be '4' or '8'", s, cfg_file());
+ error ("HD44780: bad Bits '%s' in %s, should be '4' or '8'", s, cfg_source());
return -1;
}
info ("wiring: using %d bit mode", Bits);
diff --git a/M50530.c b/M50530.c
index f570995..1544a25 100644
--- a/M50530.c
+++ b/M50530.c
@@ -1,4 +1,4 @@
-/* $Id: M50530.c,v 1.11 2003/08/16 07:31:35 reinelt Exp $
+/* $Id: M50530.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $
*
* driver for display modules based on the M50530 chip
*
@@ -20,6 +20,9 @@
*
*
* $Log: M50530.c,v $
+ * Revision 1.12 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.11 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
@@ -180,7 +183,7 @@ int M5_init (LCD *Self)
s=cfg_get("Size",NULL);
if (s==NULL || *s=='\0') {
- error ("M50530: no 'Size' entry in %s", cfg_file());
+ error ("M50530: no 'Size' entry in %s", cfg_source());
return -1;
}
if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
@@ -194,7 +197,7 @@ int M5_init (LCD *Self)
} else {
gpos=strtol(s, &e, 0);
if (*e!='\0' || gpos<0 || gpos>8) {
- error ("M50530: bad GPOs '%s' in %s", s, cfg_file());
+ error ("M50530: bad GPOs '%s' in %s", s, cfg_source());
return -1;
}
}
diff --git a/Makefile.am b/Makefile.am
index 4b6704a..754532b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,10 +7,14 @@ bin_PROGRAMS = lcd4linux
noinst_LIBRARIES = liblcd4linux.a
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall
+
lcd4linux_LDFLAGS = $(X_LIBS)
lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@
lcd4linux_DEPENDENCIES = @DRIVERS@
+liblcd4linux_a_LIBADD = @DRIVERS@
+liblcd4linux_a_DEPENDENCIES = @DRIVERS@
+
lcd4linux_SOURCES = \
lcd4linux.c \
debug.c debug.h \
@@ -54,21 +58,16 @@ XWindow.c \
Text.c
liblcd4linux_a_SOURCES = \
+display.c display.h \
+debug.c debug.h \
+cfg.c cfg.h \
+lock.c lock.h \
+pixmap.c pixmap.h \
+bar.c bar.h \
+icon.c icon.h \
+fontmap.c fontmap.h \
parport.c parport.h \
-BeckmannEgle.c \
-Crystalfontz.c \
-Cwlinux.c \
-HD44780.c \
-M50530.c \
-T6963.c \
-USBLCD.c \
-MatrixOrbital.c \
-PalmPilot.c \
-Raster.c \
-SIN.c \
-Skeleton.c \
-XWindow.c \
-Text.c
+udelay.c udelay.h
EXTRA_DIST = \
lcd4linux.conf.sample \
diff --git a/Makefile.in b/Makefile.in
index 5f72b3c..1e3f7f5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -79,17 +79,21 @@ bin_PROGRAMS = lcd4linux
noinst_LIBRARIES = liblcd4linux.a
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall
+
lcd4linux_LDFLAGS = $(X_LIBS)
lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@
lcd4linux_DEPENDENCIES = @DRIVERS@
+liblcd4linux_a_LIBADD = @DRIVERS@
+liblcd4linux_a_DEPENDENCIES = @DRIVERS@
+
lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h pid.c pid.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h exec.c exec.h mail2.c socket.c socket.h
EXTRA_lcd4linux_SOURCES = parport.c parport.h BeckmannEgle.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c MatrixOrbital.c PalmPilot.c Raster.c SIN.c Skeleton.c XWindow.c Text.c
-liblcd4linux_a_SOURCES = parport.c parport.h BeckmannEgle.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c MatrixOrbital.c PalmPilot.c Raster.c SIN.c Skeleton.c XWindow.c Text.c
+liblcd4linux_a_SOURCES = display.c display.h debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h parport.c parport.h udelay.c udelay.h
EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Drivers README.KDE
@@ -109,10 +113,8 @@ X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
-liblcd4linux_a_LIBADD =
-liblcd4linux_a_OBJECTS = parport.o BeckmannEgle.o Crystalfontz.o \
-Cwlinux.o HD44780.o M50530.o T6963.o USBLCD.o MatrixOrbital.o \
-PalmPilot.o Raster.o SIN.o Skeleton.o XWindow.o Text.o
+liblcd4linux_a_OBJECTS = display.o debug.o cfg.o lock.o pixmap.o bar.o \
+icon.o fontmap.o parport.o udelay.o
AR = ar
PROGRAMS = $(bin_PROGRAMS)
diff --git a/MatrixOrbital.c b/MatrixOrbital.c
index 6848a7e..f392db0 100644
--- a/MatrixOrbital.c
+++ b/MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: MatrixOrbital.c,v 1.33 2003/08/24 04:31:56 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.34 2003/08/24 05:17:58 reinelt Exp $
*
* driver for Matrix Orbital serial display modules
*
@@ -20,6 +20,9 @@
*
*
* $Log: MatrixOrbital.c,v $
+ * Revision 1.34 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.33 2003/08/24 04:31:56 reinelt
* icon.c icon.h added
*
@@ -326,7 +329,7 @@ static int MO_init (LCD *Self, int protocol)
port=cfg_get ("Port",NULL);
if (port==NULL || *port=='\0') {
- error ("MatrixOrbital: no 'Port' entry in %s", cfg_file());
+ error ("MatrixOrbital: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
@@ -347,7 +350,7 @@ static int MO_init (LCD *Self, int protocol)
Speed=B19200;
break;
default:
- error ("MatrixOrbital: unsupported speed '%s' in %s", s, cfg_file());
+ error ("MatrixOrbital: unsupported speed '%s' in %s", s, cfg_source());
return -1;
}
@@ -360,7 +363,7 @@ static int MO_init (LCD *Self, int protocol)
Icons=strtol(s, &e, 0);
if (*e!='\0' || Icons<0 || Icons>8) {
debug ("Icons=%d e=<%s>", Icons, e);
- error ("MatrixOrbital: bad Icons '%s' in %s, must be between 0 and 8", s, cfg_file());
+ error ("MatrixOrbital: bad Icons '%s' in %s, must be between 0 and 8", s, cfg_source());
return -1;
}
if (Icons>0) {
diff --git a/PalmPilot.c b/PalmPilot.c
index 92d2d88..7b1a8bb 100644
--- a/PalmPilot.c
+++ b/PalmPilot.c
@@ -1,4 +1,4 @@
-/* $Id: PalmPilot.c,v 1.10 2003/08/17 12:11:58 reinelt Exp $
+/* $Id: PalmPilot.c,v 1.11 2003/08/24 05:17:58 reinelt Exp $
*
* driver for 3Com Palm Pilot
*
@@ -20,6 +20,9 @@
*
*
* $Log: PalmPilot.c,v $
+ * Revision 1.11 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.10 2003/08/17 12:11:58 reinelt
* framework for icons prepared
*
@@ -222,7 +225,7 @@ int Palm_init (LCD *Self)
port=cfg_get ("Port",NULL);
if (port==NULL || *port=='\0') {
- error ("PalmPilot: no 'Port' entry in %s", cfg_file());
+ error ("PalmPilot: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
@@ -246,7 +249,7 @@ int Palm_init (LCD *Self)
Speed=B19200;
break;
default:
- error ("PalmPilot: unsupported speed '%s' in %s", speed, cfg_file());
+ error ("PalmPilot: unsupported speed '%s' in %s", speed, cfg_source());
return -1;
}
diff --git a/Raster.c b/Raster.c
index 65b7f63..631074b 100644
--- a/Raster.c
+++ b/Raster.c
@@ -1,4 +1,4 @@
-/* $Id: Raster.c,v 1.24 2003/08/17 12:11:58 reinelt Exp $
+/* $Id: Raster.c,v 1.25 2003/08/24 05:17:58 reinelt Exp $
*
* driver for raster formats
*
@@ -20,6 +20,9 @@
*
*
* $Log: Raster.c,v $
+ * Revision 1.25 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.24 2003/08/17 12:11:58 reinelt
* framework for icons prepared
*
@@ -166,8 +169,6 @@ static unsigned int foreground=0;
static unsigned int halfground=0;
static unsigned int background=0;
-extern char* output;
-
#ifdef WITH_PPM
int PPM_flush (void)
diff --git a/SIN.c b/SIN.c
index 52312c6..48f6233 100644
--- a/SIN.c
+++ b/SIN.c
@@ -1,4 +1,4 @@
-/* $Id: SIN.c,v 1.11 2003/08/17 12:11:58 reinelt Exp $
+/* $Id: SIN.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $
*
* driver for SIN router displays
*
@@ -20,6 +20,9 @@
*
*
* $Log: SIN.c,v $
+ * Revision 1.12 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.11 2003/08/17 12:11:58 reinelt
* framework for icons prepared
*
@@ -193,7 +196,7 @@ int SIN_init (LCD *Self)
port=cfg_get ("Port",NULL);
if (port==NULL || *port=='\0') {
- error ("SIN: no 'Port' entry in %s", cfg_file());
+ error ("SIN: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
diff --git a/Text.c b/Text.c
index abd6633..8b24266 100644
--- a/Text.c
+++ b/Text.c
@@ -1,4 +1,4 @@
-/* $Id: Text.c,v 1.9 2003/07/24 04:48:09 reinelt Exp $
+/* $Id: Text.c,v 1.10 2003/08/24 05:17:58 reinelt Exp $
*
* pure ncurses based text driver
*
@@ -20,6 +20,9 @@
*
*
* $Log: Text.c,v $
+ * Revision 1.10 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.9 2003/07/24 04:48:09 reinelt
* 'soft clear' needed for virtual rows
*
@@ -93,7 +96,7 @@ int main(int argc, char *argv[])
#include "display.h"
#include "bar.h"
-extern int foreground;
+extern int running_foreground;
static LCD Lcd;
static WINDOW *w, *err_win;
@@ -121,7 +124,7 @@ int Text_init (LCD *Self)
int cols=-1, rows=-1;
int scr_cols, scr_rows;
char *s;
- if (!foreground) {
+ if (!running_foreground) {
error("Text: you want me to display on /dev/null: sorry, I can't");
error("Text: Maybe you want me to run in foreground? Try '-F'");
return -1;
diff --git a/USBLCD.c b/USBLCD.c
index c9a0986..a3871aa 100644
--- a/USBLCD.c
+++ b/USBLCD.c
@@ -1,4 +1,4 @@
-/* $Id: USBLCD.c,v 1.11 2003/08/16 07:31:35 reinelt Exp $
+/* $Id: USBLCD.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $
*
* Driver for USBLCD ( see http://www.usblcd.de )
* This Driver is based on HD44780.c
@@ -22,6 +22,9 @@
*
*
* $Log: USBLCD.c,v $
+ * Revision 1.12 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.11 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
@@ -221,7 +224,7 @@ int USBLCD_init (LCD *Self)
Port=NULL;
}
if ((port=cfg_get("Port",NULL))==NULL || *port=='\0') {
- error ("USBLCD: no 'Port' entry in %s", cfg_file());
+ error ("USBLCD: no 'Port' entry in %s", cfg_source());
return -1;
}
if (port[0]=='/') {
@@ -235,7 +238,7 @@ int USBLCD_init (LCD *Self)
s=cfg_get("Size",NULL);
if (s==NULL || *s=='\0') {
- error ("USBLCD: no 'Size' entry in %s", cfg_file());
+ error ("USBLCD: no 'Size' entry in %s", cfg_source());
return -1;
}
if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
diff --git a/cfg.c b/cfg.c
index 6fd6e07..708bf59 100644
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.14 2003/08/14 03:47:40 reinelt Exp $
+/* $Id: cfg.c,v 1.15 2003/08/24 05:17:58 reinelt Exp $
*
* config file stuff
*
@@ -20,6 +20,9 @@
*
*
* $Log: cfg.c,v $
+ * Revision 1.15 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.14 2003/08/14 03:47:40 reinelt
* remove PID file if driver initialisation fails
*
@@ -91,6 +94,14 @@
/*
* exported functions:
*
+ * cfg_init (source)
+ * read configuration from source
+ * returns 0 if successful
+ * returns -1 in case of an error
+ *
+ * cfg_source (void)
+ * returns the file the configuration was read from
+ *
* cfg_cmd (arg)
* allows us to overwrite entries in the
* config-file from the command line.
@@ -98,23 +109,10 @@
* cfg_cmd can be called _before_ cfg_read()
* returns 0 if ok, -1 if arg cannot be parsed
*
- * cfg_set (key, value)
- * pre-set key's value
- * should be called before cfg_read()
- * so we can specify 'default values'
- *
* cfg_get (key, defval)
* return the a value for a given key
* or <defval> if key does not exist
*
- * cfg_read (file)
- * read configuration from file
- * returns 0 if successful
- * returns -1 in case of an error
- *
- * cfg_file (void)
- * returns the file the configuration was read from
- *
*/
@@ -193,7 +191,7 @@ static void cfg_add (char *key, char *val, int lock)
Config[i].lock=lock;
}
-int cfg_cmd (char *arg)
+int l4l_cfg_cmd (char *arg)
{
char *key, *val;
char buffer[256];
@@ -211,12 +209,7 @@ int cfg_cmd (char *arg)
return 0;
}
-void cfg_set (char *key, char *val)
-{
- cfg_add (key, val, 0);
-}
-
-char *cfg_get (char *key, char *defval)
+char *l4l_cfg_get (char *key, char *defval)
{
int i;
@@ -228,7 +221,7 @@ char *cfg_get (char *key, char *defval)
return defval;
}
-static int check_cfg_file(char *file)
+static int check_cfg_source(char *file)
{
/* as passwords and commands are stored in the config file,
* we will check that:
@@ -268,13 +261,13 @@ static int check_cfg_file(char *file)
return error;
}
-int cfg_read (char *file)
+int l4l_cfg_init (char *file)
{
FILE *stream;
char buffer[256];
char *line, *p, *s;
- if (check_cfg_file(file) == -1) {
+ if (check_cfg_source(file) == -1) {
error("config file '%s' is insecure, aborting", file);
return -1;
}
@@ -307,16 +300,23 @@ int cfg_read (char *file)
*s='\0';
p++;
}
- cfg_set (line, p);
+ cfg_add (line, p, 0);
}
fclose (stream);
return 0;
}
-char *cfg_file (void)
+char *l4l_cfg_source (void)
{
if (Config_File)
return Config_File;
else
return "";
}
+
+
+int (*cfg_init) (char *source) = l4l_cfg_init;
+char *(*cfg_source) (void) = l4l_cfg_source;
+int (*cfg_cmd) (char *arg) = l4l_cfg_cmd;
+char *(*cfg_get) (char *key, char *defval) = l4l_cfg_get;
+
diff --git a/cfg.h b/cfg.h
index 612528e..cb4b86a 100644
--- a/cfg.h
+++ b/cfg.h
@@ -1,4 +1,4 @@
-/* $Id: cfg.h,v 1.3 2003/02/22 07:53:10 reinelt Exp $
+/* $Id: cfg.h,v 1.4 2003/08/24 05:17:58 reinelt Exp $
*
* config file stuff
*
@@ -20,6 +20,9 @@
*
*
* $Log: cfg.h,v $
+ * Revision 1.4 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.3 2003/02/22 07:53:10 reinelt
* cfg_get(key,defval)
*
@@ -40,10 +43,14 @@
#ifndef _CFG_H_
#define _CFG_H_
-int cfg_cmd (char *arg);
-void cfg_set (char *key, char *value);
-char *cfg_get (char *key, char *defval);
-int cfg_read (char *file);
-char *cfg_file (void);
+extern int (*cfg_init) (char *source);
+extern char *(*cfg_source) (void);
+extern int (*cfg_cmd) (char *arg);
+extern char *(*cfg_get) (char *key, char *defval);
+
+int l4l_cfg_init (char *file);
+char *l4l_cfg_source (void);
+int l4l_cfg_cmd (char *arg);
+char *l4l_cfg_get (char *key, char *defval);
#endif
diff --git a/debug.c b/debug.c
index a90fec7..5ff185c 100644
--- a/debug.c
+++ b/debug.c
@@ -1,4 +1,4 @@
-/* $Id: debug.c,v 1.4 2003/08/08 06:58:06 reinelt Exp $
+/* $Id: debug.c,v 1.5 2003/08/24 05:17:58 reinelt Exp $
*
* debug() and error() functions
*
@@ -20,6 +20,9 @@
*
*
* $Log: debug.c,v $
+ * Revision 1.5 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.4 2003/08/08 06:58:06 reinelt
* improved forking
*
@@ -58,22 +61,24 @@
#include "debug.h"
+int running_foreground = 0;
+int running_background = 0;
+
+int verbose_level = 0;
+
void message (int level, const char *format, ...)
{
va_list ap;
char buffer[256];
static int log_open=0;
- extern int debugging;
- extern int foreground;
- extern int background;
- if (level>debugging) return;
+ if (level>verbose_level) return;
va_start(ap, format);
(void) vsnprintf(buffer, sizeof(buffer), format, ap);
va_end(ap);
- if (!background) {
+ if (!running_background) {
#ifdef WITH_TEXT
extern int curs_err(char *);
if (!curs_err(buffer))
@@ -81,7 +86,7 @@ void message (int level, const char *format, ...)
fprintf (level?stdout:stderr, "%s\n", buffer);
}
- if (foreground)
+ if (running_foreground)
return;
if (!log_open) {
diff --git a/debug.h b/debug.h
index 9bc452f..c1abd37 100644
--- a/debug.h
+++ b/debug.h
@@ -1,4 +1,4 @@
-/* $Id: debug.h,v 1.4 2001/09/12 05:37:22 reinelt Exp $
+/* $Id: debug.h,v 1.5 2003/08/24 05:17:58 reinelt Exp $
*
* debug messages
*
@@ -20,6 +20,9 @@
*
*
* $Log: debug.h,v $
+ * Revision 1.5 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.4 2001/09/12 05:37:22 reinelt
*
* fixed a bug in seti.c (file was never closed, lcd4linux run out of fd's
@@ -46,6 +49,10 @@
#ifndef _DEBUG_H_
#define _DEBUG_H_
+extern int running_foreground;
+extern int running_background;
+extern int verbose_level;
+
void message (int level, const char *format, ...);
#define debug(args...) message (2, __FILE__ ": " args)
diff --git a/display.c b/display.c
index 6896928..294bf8e 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.38 2003/08/24 04:31:56 reinelt Exp $
+/* $Id: display.c,v 1.39 2003/08/24 05:17:58 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.c,v $
+ * Revision 1.39 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.38 2003/08/24 04:31:56 reinelt
* icon.c icon.h added
*
@@ -230,6 +233,11 @@ extern LCD Skeleton[];
extern LCD XWindow[];
extern LCD Text[];
+// output file for Raster driver
+// has to be defined here because it's referenced
+// even if the raster driver is not included!
+char *output=NULL;
+
FAMILY Driver[] = {
#ifdef WITH_BECKMANNEGLE
{ "Beckmann+Egle", BeckmannEgle },
diff --git a/display.h b/display.h
index fa0ddae..9446e7e 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* $Id: display.h,v 1.18 2003/08/17 16:37:39 reinelt Exp $
+/* $Id: display.h,v 1.19 2003/08/24 05:17:58 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.h,v $
+ * Revision 1.19 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.18 2003/08/17 16:37:39 reinelt
* more icon framework
*
@@ -120,6 +123,12 @@ typedef struct {
LCD *Model;
} FAMILY;
+
+// output file for Raster driver
+// has to be defined here because it's referenced
+// even if the raster driver is not included!
+extern char *output;
+
int lcd_list (void);
int lcd_init (char *driver);
int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons, int *gpos);
diff --git a/icon.c b/icon.c
index ee9440b..fdd9fba 100644
--- a/icon.c
+++ b/icon.c
@@ -1,4 +1,4 @@
-/* $Id: icon.c,v 1.1 2003/08/24 04:31:56 reinelt Exp $
+/* $Id: icon.c,v 1.2 2003/08/24 05:17:58 reinelt Exp $
*
* generic icon and heartbeat handling
*
@@ -20,6 +20,9 @@
*
*
* $Log: icon.c,v $
+ * Revision 1.2 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.1 2003/08/24 04:31:56 reinelt
* icon.c icon.h added
*
@@ -28,9 +31,11 @@
#include <stdlib.h>
+#include <stdio.h>
-#include "icon.h"
#include "debug.h"
+#include "cfg.h"
+#include "icon.h"
static int ROWS=0;
@@ -42,6 +47,7 @@ static int ICONS=0;
static int *Screen;
+#if 0
static int icon_get_bitmap (int num)
{
int row, col;
@@ -53,6 +59,7 @@ static int icon_get_bitmap (int num)
val=cfg_get(key);
}
}
+#endif
int icon_init (int rows, int cols, int xres, int yres, int icons)
diff --git a/lcd4linux.c b/lcd4linux.c
index 91f42a9..f4e5b28 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.43 2003/08/17 16:37:39 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.44 2003/08/24 05:17:58 reinelt Exp $
*
* LCD4Linux
*
@@ -20,6 +20,9 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.44 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.43 2003/08/17 16:37:39 reinelt
* more icon framework
*
@@ -235,13 +238,12 @@
char *release="LCD4Linux " VERSION " (c) 2003 Michael Reinelt <reinelt@eunet.at>";
char **my_argv;
-char *output=NULL;
int got_signal=0;
-int debugging=0;
-int foreground=0;
-int background=0;
int tick, tack;
+extern char* output;
+
+
static void usage(void)
{
printf ("%s\n", release);
@@ -327,6 +329,9 @@ int main (int argc, char *argv[])
}
my_argv[c]=NULL;
+ running_foreground=0;
+ running_background=0;
+
#ifdef USE_OLD_UDELAY
while ((c=getopt (argc, argv, "c:dFf:hlo:qv"))!=EOF) {
#else
@@ -348,7 +353,7 @@ int main (int argc, char *argv[])
exit(1);
#endif
case 'F':
- foreground++;
+ running_foreground++;
break;
case 'f':
cfg=optarg;
@@ -367,7 +372,7 @@ int main (int argc, char *argv[])
quiet++;
break;
case 'v':
- debugging++;
+ verbose_level++;
break;
default:
exit(2);
@@ -380,26 +385,20 @@ int main (int argc, char *argv[])
}
info ("Version " VERSION " starting");
- if (!foreground && (my_argv[0]==NULL || my_argv[0][0]!='/')) {
+ if (!running_foreground && (my_argv[0]==NULL || my_argv[0][0]!='/')) {
info ("invoked without full path; restart may not work!");
}
- // set default values
- cfg_set ("row1", "*** %o %v ***");
- cfg_set ("row2", "%p CPU %r MB RAM");
- cfg_set ("row3", "Busy %cu%% $r10cu");
- cfg_set ("row4", "Load %l1%L$r10l1");
-
- if (cfg_read (cfg)==-1)
+ if (cfg_init (cfg)==-1)
exit (1);
driver=cfg_get("display",NULL);
if (driver==NULL || *driver=='\0') {
- error ("missing 'display' entry in %s!", cfg_file());
+ error ("missing 'display' entry in %s!", cfg_source());
exit (1);
}
- if (!foreground) {
+ if (!running_foreground) {
pid_t i;
int fd;
debug ("going background...");
@@ -448,7 +447,7 @@ int main (int argc, char *argv[])
}
// now we are a daemon
- background=1;
+ running_background=1;
}
debug ("initializing driver %s", driver);
diff --git a/parport.c b/parport.c
index b638cea..5c9956d 100644
--- a/parport.c
+++ b/parport.c
@@ -1,4 +1,4 @@
-/* $Id: parport.c,v 1.6 2003/08/22 03:45:09 reinelt Exp $
+/* $Id: parport.c,v 1.7 2003/08/24 05:17:58 reinelt Exp $
*
* generic parallel port handling
*
@@ -20,6 +20,9 @@
*
*
* $Log: parport.c,v $
+ * Revision 1.7 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.6 2003/08/22 03:45:09 reinelt
* bug in parallel port code fixed, more icons stuff
*
@@ -144,11 +147,11 @@ int parport_open (void)
#ifdef USE_OLD_UDELAY
s=cfg_get ("Delay",NULL);
if (s==NULL || *s=='\0') {
- error ("parport: no 'Delay' entry in %s", cfg_file());
+ error ("parport: no 'Delay' entry in %s", cfg_source());
return -1;
}
if ((loops_per_usec=strtol(s, &e, 0))==0 || *e!='\0') {
- error ("parport: bad delay '%s' in %s", s, cfg_file());
+ error ("parport: bad delay '%s' in %s", s, cfg_source());
return -1;
}
#else
@@ -157,7 +160,7 @@ int parport_open (void)
s=cfg_get ("Port",NULL);
if (s==NULL || *s=='\0') {
- error ("parport: no 'Port' entry in %s", cfg_file());
+ error ("parport: no 'Port' entry in %s", cfg_source());
return -1;
}
PPdev=NULL;
@@ -166,7 +169,7 @@ int parport_open (void)
Port=0;
PPdev=s;
#else
- error ("parport: bad Port '%s' in %s", s, cfg_file());
+ error ("parport: bad Port '%s' in %s", s, cfg_source());
return -1;
#endif
}
diff --git a/processor.c b/processor.c
index ca3f91e..3972485 100644
--- a/processor.c
+++ b/processor.c
@@ -1,4 +1,4 @@
-/* $Id: processor.c,v 1.36 2003/08/17 16:37:39 reinelt Exp $
+/* $Id: processor.c,v 1.37 2003/08/24 05:17:58 reinelt Exp $
*
* main data processing
*
@@ -20,6 +20,9 @@
*
*
* $Log: processor.c,v $
+ * Revision 1.37 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.36 2003/08/17 16:37:39 reinelt
* more icon framework
*
@@ -751,7 +754,7 @@ void process_init (void)
lines=atoi(cfg_get("Rows","1"));
if (lines<1) {
- error ("bad 'Rows' entry in %s, ignoring.", cfg_file());
+ error ("bad 'Rows' entry in %s, ignoring.", cfg_source());
lines=1;
}
if (lines>ROWS) {
@@ -761,16 +764,16 @@ void process_init (void)
if (lines>rows) {
scroll=atoi(cfg_get("Scroll","1"));
if (scroll<1) {
- error ("bad 'Scroll' entry in %s, ignoring and using '1'", cfg_file());
+ error ("bad 'Scroll' entry in %s, ignoring and using '1'", cfg_source());
scroll=1;
}
if (scroll>rows) {
- error ("'Scroll' entry in %s is %d, > %d display rows.", cfg_file(), scroll, rows);
+ error ("'Scroll' entry in %s is %d, > %d display rows.", cfg_source(), scroll, rows);
error ("This may lead to unexpected results!");
}
turn=atoi(cfg_get("Turn","1000"));
if (turn<1) {
- error ("bad 'Turn' entry in %s, ignoring and using '1000'", cfg_file());
+ error ("bad 'Turn' entry in %s, ignoring and using '1000'", cfg_source());
turn=1;
}
debug ("Virtual: %d rows, scroll %d lines every %d msec", lines, scroll, turn);
diff --git a/seti.c b/seti.c
index ede4b5e..6743e6e 100644
--- a/seti.c
+++ b/seti.c
@@ -1,4 +1,4 @@
-/* $Id: seti.c,v 1.8 2003/06/13 05:11:11 reinelt Exp $
+/* $Id: seti.c,v 1.9 2003/08/24 05:17:58 reinelt Exp $
*
* seti@home specific functions
*
@@ -20,6 +20,9 @@
*
*
* $Log: seti.c,v $
+ * Revision 1.9 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.8 2003/06/13 05:11:11 reinelt
* error message cosmetics
*
@@ -102,12 +105,12 @@ int Seti (double *perc, double *cput)
if (fd==-2) {
char *dir=cfg_get("SetiDir",NULL);
if (dir==NULL || *dir=='\0') {
- error ("no 'SetiDir' entry in %s!\n", cfg_file());
+ error ("no 'SetiDir' entry in %s!\n", cfg_source());
fd=-1;
return -1;
}
if (strlen(dir)>sizeof(fn)-sizeof(STATEFILE)-2) {
- error ("entry 'SetiDir' too long in %s!\n", cfg_file());
+ error ("entry 'SetiDir' too long in %s!\n", cfg_source());
fd=-1;
return -1;
}
diff --git a/system.c b/system.c
index 6a47e7e..2b075c9 100644
--- a/system.c
+++ b/system.c
@@ -1,4 +1,4 @@
-/* $Id: system.c,v 1.28 2003/06/26 05:31:16 reinelt Exp $
+/* $Id: system.c,v 1.29 2003/08/24 05:17:58 reinelt Exp $
*
* system status retreivement
*
@@ -20,6 +20,9 @@
*
*
* $Log: system.c,v $
+ * Revision 1.29 2003/08/24 05:17:58 reinelt
+ * liblcd4linux patch from Patrick Schemitz
+ *
* Revision 1.28 2003/06/26 05:31:16 reinelt
* bug in /proc/net/dev parsing fixed
*
@@ -774,7 +777,7 @@ int Sensor (int index, double *val, double *min, double *max)
snprintf(buffer, 32, "Sensor%d", index);
sensor[index]=cfg_get(buffer, NULL);
if (sensor[index]==NULL || *sensor[index]=='\0') {
- error ("no entry for '%s' in %s", buffer, cfg_file());
+ error ("no entry for '%s' in %s", buffer, cfg_source());
fd[index]=-1;
return -1;
}