-/* $Id: BeckmannEgle.c,v 1.17 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: BeckmannEgle.c,v 1.18 2004/01/09 04:16:06 reinelt Exp $
*
* driver for Beckmann+Egle mini terminals
*
*
*
* $Log: BeckmannEgle.c,v $
+ * Revision 1.18 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.17 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
Port=NULL;
}
- port=cfg_get ("Port", NULL);
+ port=cfg_get (NULL, "Port", NULL);
if (port==NULL || *port=='\0') {
error ("BeckmannEgle: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
- s=cfg_get("Type", NULL);
+ s=cfg_get(NULL, "Type", NULL);
if (s==NULL || *s=='\0') {
error ("BeckmannEgle: no 'Type' entry in %s", cfg_source());
return -1;
BE_write (buffer, 4); // select display type
BE_write ("\033&D", 3); // cursor off
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number("", "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, BE_define_char);
-/* $Id: Crystalfontz.c,v 1.17 2003/11/16 09:45:49 reinelt Exp $
+/* $Id: Crystalfontz.c,v 1.18 2004/01/09 04:16:06 reinelt Exp $
*
* driver for display modules from Crystalfontz
*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: Crystalfontz.c,v $
+ * Revision 1.18 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.17 2003/11/16 09:45:49 reinelt
* Crystalfontz changes, small glitch in getopt() fixed
*
char buffer[3];
int backlight;
- if (cfg_number("Backlight", 0, 0, 100, &backlight)<0) return -1;
+ if (cfg_number(NULL, "Backlight", 0, 0, 100, &backlight)<0) return -1;
snprintf (buffer, 3, "\016%c", backlight);
CF_write (buffer, 2);
return 0;
char buffer[3];
int contrast;
- if (cfg_number("Contrast", 50, 0, 100, &contrast)<0) return -1;
+ if (cfg_number(NULL, "Contrast", 50, 0, 100, &contrast)<0) return -1;
snprintf (buffer, 3, "\017%c", contrast);
CF_write (buffer, 2);
return 0;
Port=NULL;
}
- port=cfg_get ("Port",NULL);
+ port=cfg_get (NULL, "Port", NULL);
if (port==NULL || *port=='\0') {
error ("Crystalfontz: no 'Port' entry in %s", cfg_source());
return -1;
Port=strdup(port);
- if (cfg_number("Speed", 19200, 1200,19200, &speed)<0) return -1;
+ if (cfg_number(NULL, "Speed", 19200, 1200,19200, &speed)<0) return -1;
switch (speed) {
case 1200:
Device=CF_open();
if (Device==-1) return -1;
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, CF_define_char);
-/* $Id: Cwlinux.c,v 1.16 2003/11/30 16:18:36 reinelt Exp $
+/* $Id: Cwlinux.c,v 1.17 2004/01/09 04:16:06 reinelt Exp $
*
* driver for Cwlinux serial display modules
*
*
*
* $Log: Cwlinux.c,v $
+ * Revision 1.17 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.16 2003/11/30 16:18:36 reinelt
* Cwlinux: invalidate Framebuffer in case a char got redefined
*
int level;
char cmd[5]="\376A_\375";
- if (cfg_number("Brightness", 8, 0, 8, &level)<0) return;
+ if (cfg_number(NULL, "Brightness", 8, 0, 8, &level)<0) return;
switch (level) {
case 0:
Port = NULL;
}
- port = cfg_get("Port",NULL);
+ port = cfg_get(NULL, "Port",NULL);
if (port == NULL || *port == '\0') {
error("Cwlinux: no 'Port' entry in %s", cfg_source());
return -1;
}
Port = strdup(port);
- if (cfg_number("Speed", 19200, 9600,19200, &speed)<0) return -1;
+ if (cfg_number(NULL, "Speed", 19200, 9600,19200, &speed)<0) return -1;
switch (speed) {
case 9600:
Speed = B9600;
// backlight brightness
CW_Brightness();
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, Lcd.xres, Lcd.yres, CHARS, Icons, CW12232_define_char);
-/* $Id: HD44780.c,v 1.48 2004/01/06 22:33:13 reinelt Exp $
+/* $Id: HD44780.c,v 1.49 2004/01/09 04:16:06 reinelt Exp $
*
* driver for display modules based on the HD44780 chip
*
*
*
* $Log: HD44780.c,v $
+ * Revision 1.49 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.48 2004/01/06 22:33:13 reinelt
* Copyright statements cleaned up
*
int rows=-1, cols=-1, gpos=-1;
char *s;
- s=cfg_get("Size",NULL);
+ s=cfg_get(NULL, "Size", NULL);
if (s==NULL || *s=='\0') {
error ("HD44780: no 'Size' entry in %s", cfg_source());
return -1;
return -1;
}
- if (cfg_number("GPOs", 0, 0, 8, &gpos)<0) return -1;
+ if (cfg_number(NULL, "GPOs", 0, 0, 8, &gpos)<0) return -1;
info ("HD44780: controlling %d GPO's", gpos);
- if (cfg_number("Controllers", 1, 1, 2, &Controllers)<0) return -1;
+ if (cfg_number(NULL, "Controllers", 1, 1, 2, &Controllers)<0) return -1;
info ("wiring: using display with %d controllers", Controllers);
// current controller
return -1;
}
- if (cfg_number("Bits", 8, 4, 8, &Bits)<0) return -1;
+ if (cfg_number(NULL, "Bits", 8, 4, 8, &Bits)<0) return -1;
if (Bits!=4 && Bits!=8) {
error ("HD44780: bad Bits '%s' in %s, should be '4' or '8'", s, cfg_source());
return -1;
HD_command (0x03, 0x0c, T_CLEAR); // Display on, cursor off, blink off, wait 1.64 ms
HD_command (0x03, 0x06, T_EXEC); // curser moves to right, no shift
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, HD_define_char);
-/* $Id: M50530.c,v 1.16 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: M50530.c,v 1.17 2004/01/09 04:16:06 reinelt Exp $
*
* driver for display modules based on the M50530 chip
*
*
*
* $Log: M50530.c,v $
+ * Revision 1.17 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.16 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
int rows=-1, cols=-1, gpos=-1;
char *s;
- s=cfg_get("Size",NULL);
+ s=cfg_get(NULL, "Size", NULL);
if (s==NULL || *s=='\0') {
error ("M50530: no 'Size' entry in %s", cfg_source());
return -1;
return -1;
}
- if (cfg_number("GPOs", 0, 0, 8, &gpos)<0) return -1;
+ if (cfg_number(NULL, "GPOs", 0, 0, 8, &gpos)<0) return -1;
Self->rows=rows;
Self->cols=cols;
M5_command (0x0050, 20); // set entry mode
M5_command (0x0030, 20); // set display mode
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, M5_define_char);
-/* $Id: MatrixOrbital.c,v 1.49 2003/12/19 05:35:14 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.50 2004/01/09 04:16:06 reinelt Exp $
*
* driver for Matrix Orbital serial display modules
*
*
*
* $Log: MatrixOrbital.c,v $
+ * Revision 1.50 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.49 2003/12/19 05:35:14 reinelt
* renamed 'client' to 'plugin'
*
char buffer[4];
int contrast;
- if (cfg_number("Contrast", 160, 0, 255, &contrast)<0) return -1;
+ if (cfg_number(NULL, "Contrast", 160, 0, 255, &contrast)<0) return -1;
snprintf (buffer, 4, "\376P%c", contrast);
MO_write (buffer, 3);
return 0;
Port=NULL;
}
- port=cfg_get ("Port",NULL);
+ port=cfg_get (NULL, "Port", NULL);
if (port==NULL || *port=='\0') {
error ("MatrixOrbital: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
- if (cfg_number("Speed", 19200, 1200, 19200, &i)<0) return -1;
+ if (cfg_number(NULL, "Speed", 19200, 1200, 19200, &i)<0) return -1;
switch (i) {
case 1200:
Speed=B1200;
info ("Display on %s has Firmware Version 0x%x", Port, *buffer);
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, MO_define_char);
-/* $Id: MilfordInstruments.c,v 1.4 2004/01/06 22:33:13 reinelt Exp $
+/* $Id: MilfordInstruments.c,v 1.5 2004/01/09 04:16:06 reinelt Exp $
*
* driver for Milford Instruments 'BPK' piggy-back serial interface board
* for standard Hitachi 44780 compatible lcd modules.
*
*
* $Log: MilfordInstruments.c,v $
+ * Revision 1.5 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.4 2004/01/06 22:33:13 reinelt
* Copyright statements cleaned up
*
Port=NULL;
}
- port=cfg_get ("Port",NULL);
+ port=cfg_get (NULL, "Port", NULL);
if (port==NULL || *port=='\0') {
error ("MilfordInstruments: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
- if (cfg_number("Speed", 19200, 1200,19200, &speed)<0) return -1;
+ if (cfg_number(NULL, "Speed", 19200, 1200,19200, &speed)<0) return -1;
switch (speed) {
case 2400:
Speed=B2400;
Device=MI_open();
if (Device==-1) return -1;
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, MI_define_char);
-/* $Id: PalmPilot.c,v 1.14 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: PalmPilot.c,v 1.15 2004/01/09 04:16:06 reinelt Exp $
*
* driver for 3Com Palm Pilot
*
*
*
* $Log: PalmPilot.c,v $
+ * Revision 1.15 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.14 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
Port=NULL;
}
- port=cfg_get ("Port",NULL);
+ port=cfg_get (NULL, "Port", NULL);
if (port==NULL || *port=='\0') {
error ("PalmPilot: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
- if (cfg_number("Speed", 19200, 1200,19200, &speed)<0) return -1;
+ if (cfg_number(NULL, "Speed", 19200, 1200,19200, &speed)<0) return -1;
switch (speed) {
case 1200:
debug ("using port %s at %d baud", Port, speed);
- if (sscanf(s=cfg_get("size","20x4"), "%dx%d", &cols, &rows)!=2 || rows<1 || cols<1) {
+ if (sscanf(s=cfg_get(NULL, "size", "20x4"), "%dx%d", &cols, &rows)!=2 || rows<1 || cols<1) {
error ("PalmPilot: bad size '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("font","6x8"), "%dx%d", &xres, &yres)!=2 || xres<5 || yres<7) {
+ if (sscanf(s=cfg_get(NULL, "font", "6x8"), "%dx%d", &xres, &yres)!=2 || xres<5 || yres<7) {
error ("PalmPilot: bad font '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("pixel","1+0"), "%d+%d", &pixel, &pgap)!=2 || pixel<1 || pgap<0) {
+ if (sscanf(s=cfg_get(NULL, "pixel", "1+0"), "%d+%d", &pixel, &pgap)!=2 || pixel<1 || pgap<0) {
error ("PalmPilot: bad pixel '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("gap","0x0"), "%dx%d", &cgap, &rgap)!=2 || cgap<-1 || rgap<-1) {
+ if (sscanf(s=cfg_get(NULL, "gap", "0x0"), "%dx%d", &cgap, &rgap)!=2 || cgap<-1 || rgap<-1) {
error ("PalmPilot: bad gap '%s'", s);
return -1;
}
if (rgap<0) rgap=pixel+pgap;
if (cgap<0) cgap=pixel+pgap;
- if (cfg_number("border", 0, 0, 1000000, &border)<0) return -1;
+ if (cfg_number(NULL, "border", 0, 0, 1000000, &border)<0) return -1;
if (pix_init (rows, cols, xres, yres)!=0) {
error ("PalmPilot: pix_init(%d, %d, %d, %d) failed", rows, cols, xres, yres);
return -1;
}
- if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, 8, &icons) < 0) return -1;
if (icons>0) {
info ("allocating %d icons", icons);
icon_init(rows, cols, xres, yres, 8, icons, pix_icon);
-/* $Id: Raster.c,v 1.28 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: Raster.c,v 1.29 2004/01/09 04:16:06 reinelt Exp $
*
* driver for raster formats
*
*
*
* $Log: Raster.c,v $
+ * Revision 1.29 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.28 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
return -1;
}
- if (sscanf(s=cfg_get("size","20x4"), "%dx%d", &cols, &rows)!=2 || rows<1 || cols<1) {
+ if (sscanf(s=cfg_get(NULL, "size", "20x4"), "%dx%d", &cols, &rows)!=2 || rows<1 || cols<1) {
error ("Raster: bad size '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("font","5x8"), "%dx%d", &xres, &yres)!=2 || xres<5 || yres<7) {
+ if (sscanf(s=cfg_get(NULL, "font", "5x8"), "%dx%d", &xres, &yres)!=2 || xres<5 || yres<7) {
error ("Raster: bad font '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("pixel","4+1"), "%d+%d", &pixel, &pgap)!=2 || pixel<1 || pgap<0) {
+ if (sscanf(s=cfg_get(NULL, "pixel", "4+1"), "%d+%d", &pixel, &pgap)!=2 || pixel<1 || pgap<0) {
error ("Raster: bad pixel '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("gap","3x3"), "%dx%d", &cgap, &rgap)!=2 || cgap<-1 || rgap<-1) {
+ if (sscanf(s=cfg_get(NULL, "gap", "3x3"), "%dx%d", &cgap, &rgap)!=2 || cgap<-1 || rgap<-1) {
error ("Raster: bad gap '%s'", s);
return -1;
}
if (rgap<0) rgap=pixel+pgap;
if (cgap<0) cgap=pixel+pgap;
- if (cfg_number("border", 0, 0, 1000000, &border)<0) return -1;
+ if (cfg_number(NULL, "border", 0, 0, 1000000, &border)<0) return -1;
- if (sscanf(s=cfg_get("foreground","#102000"), "#%x", &foreground)!=1) {
+ if (sscanf(s=cfg_get(NULL, "foreground", "#102000"), "#%x", &foreground)!=1) {
error ("Raster: bad foreground color '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("halfground","#70c000"), "#%x", &halfground)!=1) {
+ if (sscanf(s=cfg_get(NULL, "halfground", "#70c000"), "#%x", &halfground)!=1) {
error ("Raster: bad halfground color '%s'", s);
return -1;
}
- if (sscanf(s=cfg_get("background","#80d000"), "#%x", &background)!=1) {
+ if (sscanf(s=cfg_get(NULL, "background", "#80d000"), "#%x", &background)!=1) {
error ("Raster: bad background color '%s'", s);
return -1;
}
return -1;
}
- if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, 8, &icons) < 0) return -1;
if (icons>0) {
info ("allocating %d icons", icons);
icon_init(rows, cols, xres, yres, 8, icons, pix_icon);
-/* $Id: T6963.c,v 1.13 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: T6963.c,v 1.14 2004/01/09 04:16:06 reinelt Exp $
*
* driver for display modules based on the Toshiba T6963 chip
*
*
*
* $Log: T6963.c,v $
+ * Revision 1.14 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.13 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
return -1;
}
- if (cfg_number("Icons", 0, 0, 8, &Icons) < 0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, 8, &Icons) < 0) return -1;
if (Icons>0) {
info ("allocating %d icons", Icons);
icon_init(Lcd.rows, Lcd.cols, Lcd.xres, Lcd.yres, 8, Icons, pix_icon);
-/* $Id: Text.c,v 1.12 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: Text.c,v 1.13 2004/01/09 04:16:06 reinelt Exp $
*
* pure ncurses based text driver
*
*
*
* $Log: Text.c,v $
+ * Revision 1.13 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.12 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
return -1;
}
- if (sscanf(s=cfg_get("size","20x4"), "%dx%d", &cols, &rows)!=2 || rows<1 || cols<1) {
+ if (sscanf(s=cfg_get(NULL, "size", "20x4"), "%dx%d", &cols, &rows)!=2 || rows<1 || cols<1) {
error ("Text: bad size '%s'", s);
return -1;
}
int Text_bar (int type, int row, int col, int max, int len1, int len2)
{
int len, i;
- if (cfg_get("TextBar", NULL))
+ if (cfg_get(NULL, "TextBar", NULL))
mvwprintw(w, row+1 , col+1, "%d %d %d", max, len1, len2);
else {
len = min(len1, len2);
-/* $Id: USBLCD.c,v 1.19 2004/01/06 22:33:14 reinelt Exp $
+/* $Id: USBLCD.c,v 1.20 2004/01/09 04:16:06 reinelt Exp $
*
* Driver for USBLCD (see http://www.usblcd.de)
*
*
*
* $Log: USBLCD.c,v $
+ * Revision 1.20 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.19 2004/01/06 22:33:14 reinelt
* Copyright statements cleaned up
*
free(Port);
Port=NULL;
}
- if ((port=cfg_get("Port",NULL))==NULL || *port=='\0') {
+ if ((port=cfg_get(NULL, "Port", NULL))==NULL || *port=='\0') {
error ("USBLCD: no 'Port' entry in %s", cfg_source());
return -1;
}
debug ("using device %s ", Port);
- s=cfg_get("Size",NULL);
+ s=cfg_get(NULL, "Size", NULL);
if (s==NULL || *s=='\0') {
error ("USBLCD: no 'Size' entry in %s", cfg_source());
return -1;
if (USBLCD_open()!=0)
return -1;
- if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
if (Icons>0) {
debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, USBLCD_define_char);
-/* $Id: XWindow.c,v 1.37 2004/01/06 22:33:14 reinelt Exp $
+/* $Id: XWindow.c,v 1.38 2004/01/09 04:16:06 reinelt Exp $
*
* X11 Driver for LCD4Linux
*
*
*
* $Log: XWindow.c,v $
+ * Revision 1.38 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.37 2004/01/06 22:33:14 reinelt
* Copyright statements cleaned up
*
{
char *s;
- if (sscanf(s=cfg_get("size","20x4"),"%dx%d",&cols,&rows)!=2
+ if (sscanf(s=cfg_get(NULL, "size", "20x4"),"%dx%d",&cols,&rows)!=2
|| rows<1 || cols<1) {
error ("X11: bad size '%s'",s);
return -1;
}
- if (sscanf(s=cfg_get("font","5x8"),"%dx%d",&xres,&yres)!=2
+ if (sscanf(s=cfg_get(NULL, "font", "5x8"),"%dx%d",&xres,&yres)!=2
|| xres<5 || yres>10) {
error ("X11: bad font '%s'",s);
return -1;
}
- if (sscanf(s=cfg_get("pixel","4+1"),"%d+%d",&pixel,&pgap)!=2
+ if (sscanf(s=cfg_get(NULL, "pixel", "4+1"),"%d+%d",&pixel,&pgap)!=2
|| pixel<1 || pgap<0) {
error ("X11: bad pixel '%s'",s);
return -1;
}
- if (sscanf(s=cfg_get("gap","-1x-1"),"%dx%d",&cgap,&rgap)!=2
+ if (sscanf(s=cfg_get(NULL, "gap", "-1x-1"),"%dx%d",&cgap,&rgap)!=2
|| cgap<-1 || rgap<-1) {
error ("X11: bad gap '%s'",s);
return -1;
if (rgap<0) rgap=pixel+pgap;
if (cgap<0) cgap=pixel+pgap;
- if (cfg_number("border", 0, 0, 1000000, &border)<0) return -1;
+ if (cfg_number(NULL, "border", 0, 0, 1000000, &border)<0) return -1;
- rgbfg=cfg_get("foreground","#000000");
- rgbbg=cfg_get("background","#80d000");
- rgbhg=cfg_get("halfground","#70c000");
+ rgbfg=cfg_get(NULL, "foreground", "#000000");
+ rgbbg=cfg_get(NULL, "background", "#80d000");
+ rgbhg=cfg_get(NULL, "halfground", "#70c000");
if (*rgbfg=='\\') rgbfg++;
if (*rgbbg=='\\') rgbbg++;
if (*rgbhg=='\\') rgbhg++;
if (pix_init(rows,cols,xres,yres)==-1) return -1;
- if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1;
+ if (cfg_number(NULL, "Icons", 0, 0, 8, &icons) < 0) return -1;
if (icons>0) {
info ("allocating %d icons", icons);
icon_init(rows, cols, xres, yres, 8, icons, pix_icon);
-/* $Id: cfg.c,v 1.22 2004/01/08 06:00:28 reinelt Exp $^
+/* $Id: cfg.c,v 1.23 2004/01/09 04:16:06 reinelt Exp $^
*
* config file stuff
*
*
*
* $Log: cfg.c,v $
+ * Revision 1.23 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.22 2004/01/08 06:00:28 reinelt
* allowed '.' in key names
- * allowed empty group keys (not only "group anything {", but "anything {")
+ * allowed empty section keys (not only "section anything {", but "anything {")
*
* Revision 1.21 2004/01/08 05:28:12 reinelt
* Luk Claes added to AUTHORS
- * cfg: group handling ('{}') added
+ * cfg: section handling ('{}') added
*
* Revision 1.20 2004/01/07 10:15:41 reinelt
* small glitch in evaluator fixed
* cfg_cmd can be called _before_ cfg_read()
* returns 0 if ok, -1 if arg cannot be parsed
*
- * cfg_get (key, defval)
- * return the a value for a given key
+ * cfg_get (section, key, defval)
+ * return the a value for a given key in a given section
* or <defval> if key does not exist
*
+ * cfg_number (section, key, defval, min, int max, *value)
+ * return the a value for a given key in a given section
+ * convert it into a number with syntax checking
+ * check if its in a given range
+ *
*/
}
-static void cfg_add (char *group, char *key, char *val, int lock)
+static void cfg_add (char *section, char *key, char *val, int lock)
{
char *buffer;
ENTRY *entry;
// allocate buffer
- buffer=malloc(strlen(group)+strlen(key)+2);
+ buffer=malloc(strlen(section)+strlen(key)+2);
*buffer='\0';
- // prepare group:key
- if (*group!='\0') {
- strcpy(buffer, group);
+ // prepare section.key
+ if (section!=NULL && *section!='\0') {
+ strcpy(buffer, section);
strcat(buffer, ".");
}
strcat (buffer, key);
+ // does the key already exist?
entry=bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
if (entry!=NULL) {
+ free (buffer);
if (entry->lock>lock) return;
+ debug ("Warning: key '%s': value '%s' overwritten with '%s'", buffer, entry->val, val);
if (entry->val) free (entry->val);
entry->val=dequote(strdup(val));
return;
}
-char *l4l_cfg_get (char *key, char *defval)
+char *l4l_cfg_get (char *section, char *key, char *defval)
{
+ int len;
+ char *buffer;
ENTRY *entry;
- entry=bsearch(key, Config, nConfig, sizeof(ENTRY), c_lookup);
+ // calculate key length
+ len=strlen(key)+1;
+ if (section!=NULL)
+ len+=strlen(section)+1;
+
+ // allocate buffer
+ buffer=malloc(len);
+ *buffer='\0';
+
+ // prepare section:key
+ if (section!=NULL && *section!='\0') {
+ strcpy(buffer, section);
+ strcat(buffer, ".");
+ }
+ strcat (buffer, key);
+
+ // search entry
+ entry=bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
+
+ // free buffer again
+ free (buffer);
if (entry!=NULL)
return entry->val;
}
-int l4l_cfg_number (char *key, int defval, int min, int max, int *value)
+int l4l_cfg_number (char *section, char *key, int defval, int min, int max, int *value)
{
char *s, *e;
- s=cfg_get(key, NULL);
+ s=cfg_get(section, key, NULL);
if (s==NULL) {
*value=defval;
return 0;
{
FILE *stream;
char buffer[256];
- char group[256];
+ char section[256];
char *line, *key, *val, *end;
- int group_open, group_close;
+ int section_open, section_close;
int error, lineno;
stream=fopen (file, "r");
return -1;
}
- // start with empty group
- strcpy(group, "");
+ // start with empty section
+ strcpy(section, "");
error=0;
lineno=0;
// skip empty lines
if (*(line=strip(line, 1))=='\0') continue;
- // reset group flags
- group_open=0;
- group_close=0;
+ // reset section flags
+ section_open=0;
+ section_close=0;
// key is first word
key=line;
if (*val) for (end=val; *(end+1); end++);
else end=val;
- // if last char is '{', a group has been opened
+ // if last char is '{', a section has been opened
if (*end=='{') {
- group_open=1;
+ section_open=1;
*end='\0';
val=strip(val, 0);
}
val++;
}
- // if key is '}', a group has been closed
+ // if key is '}', a section has been closed
if (strcmp(key, "}")==0) {
- group_close=1;
+ section_close=1;
*key='\0';
}
// sanity check: '}' should be the only char in a line
- if (group_close && (group_open || *val!='\0')) {
+ if (section_close && (section_open || *val!='\0')) {
error ("error in config file '%s' line %d: garbage after '}'", file, lineno);
error=1;
break;
break;
}
- // on group-open, check value for valid chars
- if (group_open && !validchars(val)) {
- error ("error in config file '%s' line %d: group '%s' is invalid", file, lineno, val);
+ // on section-open, check value for valid chars
+ if (section_open && !validchars(val)) {
+ error ("error in config file '%s' line %d: section '%s' is invalid", file, lineno, val);
error=1;
break;
}
- // on group-open, append new group name
- if (group_open) {
- // is the group[] array big enough?
- if (strlen(group)+strlen(key)+3 > sizeof(group)) {
- error ("error in config file '%s' line %d: group buffer overflow", file, lineno);
+ // on section-open, append new section name
+ if (section_open) {
+ // is the section[] array big enough?
+ if (strlen(section)+strlen(key)+3 > sizeof(section)) {
+ error ("error in config file '%s' line %d: section buffer overflow", file, lineno);
error=1;
break;
}
- if (*group!='\0') strcat (group, ".");
- strcat (group, key);
+ if (*section!='\0') strcat (section, ".");
+ strcat (section, key);
if (*val!='\0') {
- strcat (group, ":");
- strcat (group, val);
+ strcat (section, ":");
+ strcat (section, val);
}
continue;
}
- // on group-close, remove last group name
- if (group_close) {
- // sanity check: group already empty?
- if (*group=='\0') {
+ // on section-close, remove last section name
+ if (section_close) {
+ // sanity check: section already empty?
+ if (*section=='\0') {
error ("error in config file '%s' line %d: unmatched closing brace", file, lineno);
error=1;
break;
}
- end=strrchr(group, '.');
+ end=strrchr(section, '.');
if (end==NULL)
- *group='\0';
+ *section='\0';
else
*end='\0';
continue;
}
// finally: add key
- debug ("Michi: add group=<%s> key=<%s> val=<%s>", group, key, val);
- cfg_add (group, key, val, 0);
+ cfg_add (section, key, val, 0);
}
// sanity check: are the braces balanced?
- if (!error && *group!='\0') {
+ if (!error && *section!='\0') {
error ("error in config file '%s' line %d: unbalanced braces", file, lineno);
error=1;
}
}
-static void cfg_plugin (RESULT *result, RESULT *arg1)
+static void cfg_plugin (RESULT *result, int argc, RESULT *argv[])
{
- char *value=cfg_get(R2S(arg1), "");
+ int i, len;
+ char *value;
+ char *buffer;
+
+ // calculate key length
+ len=0;
+ for (i=0; i<argc; i++) {
+ len+=strlen(R2S(argv[i]))+1;
+ }
+
+ // allocate key buffer
+ buffer=malloc(len+1);
+
+ // prepare key buffer
+ *buffer='\0';
+ for (i=0; i<argc; i++) {
+ strcat (buffer, ".");
+ strcat (buffer, R2S(argv[i]));
+ }
+
+ // buffer starts with '.', so cut off first char
+ value=cfg_get("", buffer+1, "");
+
+ // free buffer again
+ free (buffer);
+
+ // store result
SetResult(&result, R_STRING, value);
}
Config_File=strdup(file);
// register as a plugin
- AddFunction ("cfg", 1, cfg_plugin);
+ AddFunction ("cfg", -1, cfg_plugin);
return 0;
}
}
-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;
-int (*cfg_number) (char *key, int defval,
- int min, int max, int *value) = l4l_cfg_number;
+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 *section, char *key, char *defval) = l4l_cfg_get;
+int (*cfg_number) (char *section, char *key, int defval,
+ int min, int max, int *value) = l4l_cfg_number;
-/* $Id: cfg.h,v 1.6 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: cfg.h,v 1.7 2004/01/09 04:16:06 reinelt Exp $
*
* config file stuff
*
*
*
* $Log: cfg.h,v $
+ * Revision 1.7 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.6 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
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);
-extern int (*cfg_number) (char *key, int defval,
+extern char *(*cfg_get) (char *section, char *key, char *defval);
+extern int (*cfg_number) (char *section, char *key, int defval,
int min, int max, int *value);
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);
-int l4l_cfg_number (char *key, int defval,
+char *l4l_cfg_get (char *section, char *key, char *defval);
+int l4l_cfg_number (char *section, char *key, int defval,
int min, int max, int *value);
#endif
-/* $Id: exec.c,v 1.10 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: exec.c,v 1.11 2004/01/09 04:16:06 reinelt Exp $
*
* exec ('x*') functions
*
*
*
* $Log: exec.c,v $
+ * Revision 1.11 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.10 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
if (now[index] > 0) {
/* delay in Ticks ? */
sprintf(xn, "Tick_x%d", index);
- p = cfg_get(xn,NULL);
+ p = cfg_get(NULL, xn, NULL);
if (p && *p) {
if (ticks[index]++ % atoi(p) != 0)
return 0;
else {
sprintf(xn, "Delay_x%d", index);
/* delay in Delay_x* sec ? */
- if (time(NULL) <= now[index] + atoi(cfg_get(xn,"1"))) {
+ if (time(NULL) <= now[index] + atoi(cfg_get(NULL, xn, "1"))) {
return 0;
}
}
*val = -1;
sprintf(xn, "x%d", index);
- command = cfg_get(xn,NULL);
+ command = cfg_get(NULL, xn, NULL);
if (!command || !*command) {
error("Empty command for 'x%d'", index);
double max, min;
*val = atof(buff);
sprintf(xn, "Max_x%d", index);
- max = atof(cfg_get(xn,"100"));
+ max = atof(cfg_get(NULL, xn, "100"));
sprintf(xn, "Min_x%d", index);
- min = atof(cfg_get(xn,"0"));
+ min = atof(cfg_get(NULL, xn, "0"));
if (max != min)
*val = (*val - min)/(max - min);
}
-/* $Id: expr.c,v 1.1 2004/01/05 11:57:38 reinelt Exp $
+/* $Id: expr.c,v 1.2 2004/01/09 04:16:06 reinelt Exp $
*
* expr ('y*') functions
* This is only a workaround to make the Evaluator usable until
*
*
* $Log: expr.c,v $
+ * Revision 1.2 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.1 2004/01/05 11:57:38 reinelt
* added %y tokens to make the Evaluator useable
*
return -1;
sprintf(yn, "y%d", index);
- expression = cfg_get(yn,NULL);
+ expression = cfg_get(NULL, yn, NULL);
if (!expression || !*expression) {
error("Empty expression for 'y%d'", index);
double max, min;
*val = atof(result);
sprintf(yn, "Max_y%d", index);
- max = atof(cfg_get(yn,"100"));
+ max = atof(cfg_get(NULL, yn, "100"));
sprintf(yn, "Min_y%d", index);
- min = atof(cfg_get(yn,"0"));
+ min = atof(cfg_get(NULL, yn, "0"));
if (max != min)
*val = (*val - min)/(max - min);
}
-/* $Id: filter.c,v 1.8 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: filter.c,v 1.9 2004/01/09 04:16:06 reinelt Exp $
*
* smooth and damp functions
*
*
*
* $Log: filter.c,v $
+ * Revision 1.9 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.8 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
int i, j;
if (tau==-1)
- if (cfg_number("tau", 500, 0, 1000000, &tau)<0) tau=0.0;
+ if (cfg_number(NULL, "tau", 500, 0, 1000000, &tau)<0) tau=0.0;
if (tau==0.0)
return value;
-/* $Id: icon.c,v 1.11 2003/10/22 04:32:25 reinelt Exp $
+/* $Id: icon.c,v 1.12 2004/01/09 04:16:06 reinelt Exp $
*
* generic icon and heartbeat handling
*
*
*
* $Log: icon.c,v $
+ * Revision 1.12 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.11 2003/10/22 04:32:25 reinelt
* fixed icon bug found by Rob van Nieuwkerk
*
for (row=0; row<YRES; row++) {
snprintf (key, sizeof(key), "Icon%d.Bitmap%d", num+1, row+1);
- val=cfg_get(key, "");
+ val=cfg_get(NULL, key, "");
map=bm->Data+row;
n=0;
for (v=val; *v!='\0'; v++) {
-/* $Id: imon.c,v 1.2 2004/01/06 22:33:14 reinelt Exp $
+/* $Id: imon.c,v 1.3 2004/01/09 04:16:06 reinelt Exp $
*
* imond/telmond data processing
*
*
*
* $Log: imon.c,v $
+ * Revision 1.3 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.2 2004/01/06 22:33:14 reinelt
* Copyright statements cleaned up
*
int port;
int connect;
- host=cfg_get ("Imon_Host","127.0.0.1");
+ host=cfg_get (NULL, "Imon_Host", "127.0.0.1");
if (*host=='\0') {
error ("Imon: no 'Imon_Host' entry in %s", cfg_source());
return -1;
}
- if (cfg_number("Imon_Port",5000,1,65536,&port)<0){
+ if (cfg_number(NULL, "Imon_Port", 5000,1,65536,&port)<0){
return -1;
}
connect=service_connect(host,port);
- s=cfg_get ("Imon_Pass",NULL);
+ s=cfg_get (NULL, "Imon_Pass", NULL);
if ((s!=NULL) && (*s!='\0')) { // Passwort senden
char buf[40];
sprintf(buf,"pass %s",s);
if ((*ch).max_in == 0){ // not initializied
sprintf(buf, "Imon_%d_Dev", index);
- s=cfg_get(buf,NULL);
+ s=cfg_get(NULL, buf, NULL);
if (s==NULL) {
error ("Imon: no 'Imon_%i_Dev' entry in %s", index, cfg_source());
err[index]=1;
strcpy((*ch).dev,s);
sprintf(buf, "Imon_%d_MaxIn", index);
- cfg_number(buf,768,1,65536,&(*ch).max_in);
+ cfg_number(NULL, buf,768,1,65536,&(*ch).max_in);
sprintf(buf, "Imon_%d_MaxOut", index);
- cfg_number(buf,128,1,65536,&(*ch).max_out);
+ cfg_number(NULL, buf, 128,1,65536,&(*ch).max_out);
}
sprintf(buf, "status %s", (*ch).dev);
FILE * fp;
char line[256];
- fp = fopen (cfg_get ("Telmon_Phonebook","/etc/phonebook"), "r");
+ fp = fopen (cfg_get (NULL, "Telmon_Phonebook","/etc/phonebook"), "r");
if (! fp) return;
if (tick++ % 50 != 0) return 0;
if (telmond_fd == -2){ //not initializied
- char *s=cfg_get ("Telmon_Host","127.0.0.1");
+ char *s=cfg_get (NULL, "Telmon_Host","127.0.0.1");
if (*s=='\0') {
error ("Telmon: no 'Telmon_Host' entry in %s", cfg_source());
telmond_fd=-1;
}
strcpy(host,s);
- if (cfg_number("Telmon_Port",5000,1,65536,&port)<0){
+ if (cfg_number(NULL, "Telmon_Port",5000,1,65536,&port)<0){
telmond_fd=-1;
return -1;
}
-/* $Id: lcd4linux.c,v 1.54 2004/01/08 05:28:12 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.55 2004/01/09 04:16:06 reinelt Exp $
*
* LCD4Linux
*
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.55 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.54 2004/01/08 05:28:12 reinelt
* Luk Claes added to AUTHORS
* cfg: group handling ('{}') added
if (cfg_init(cfg)==-1)
exit (1);
- driver=cfg_get("display",NULL);
+ driver=cfg_get(NULL, "display", NULL);
if (driver==NULL || *driver=='\0') {
error ("missing 'display' entry in %s!", cfg_source());
exit (1);
// check the conf to see if quiet startup is wanted
if (!quiet) {
- quiet = atoi(cfg_get("Quiet", "0"));
+ quiet = atoi(cfg_get(NULL, "Quiet", "0"));
}
if (!quiet && hello()) {
-/* $Id: mail.c,v 1.13 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: mail.c,v 1.14 2004/01/09 04:16:06 reinelt Exp $
*
* email specific functions
*
*
*
* $Log: mail.c,v $
+ * Revision 1.14 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.13 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
}
if (now[index] > 0) { /* not first time, delay */
sprintf(txt1, "Delay_e%d", index);
- if (time(NULL)<=now[index]+atoi(cfg_get(txt1,"5")))
+ if (time(NULL)<=now[index]+atoi(cfg_get(NULL, txt1, "5")))
return 0; // no more then 5/Delay_eX seconds after last check?
}
time(&now[index]); // for Mailbox #index
Build the filename from the config
*/
snprintf(buffer, sizeof(buffer), "Mailbox%d", index);
- fnp1=cfg_get(buffer,NULL);
+ fnp1=cfg_get(NULL, buffer, NULL);
if (fnp1==NULL || *fnp1=='\0') {
cfgmbx[index]=FALSE; // There is now entry for Mailbox #index
}
-/* $Id: mail2.c,v 1.9 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: mail2.c,v 1.10 2004/01/09 04:16:06 reinelt Exp $
*
* mail: pop3, imap, news functions
*
*
*
* $Log: mail2.c,v $
+ * Revision 1.10 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.9 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
*total = 0;
*unseen = 0;
- strcpy(buf, cfg_get("Newsrc",".newsrc"));
+ strcpy(buf, cfg_get(NULL, "Newsrc", ".newsrc"));
if (*buf == 0 || ((fp = fopen(buf, "r")) == NULL)) {
error("Couldn't open .newsrc-file '%s'", buf);
return -1;
-/* $Id: parport.c,v 1.11 2003/10/08 14:21:10 reinelt Exp $
+/* $Id: parport.c,v 1.12 2004/01/09 04:16:06 reinelt Exp $
*
* generic parallel port handling
*
*
*
* $Log: parport.c,v $
+ * Revision 1.12 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.11 2003/10/08 14:21:10 reinelt
* Changelog; small type in parport.c
*
char *s, *e;
#ifdef USE_OLD_UDELAY
- if (cfg_number("Delay", 0, 1, 1000000000, &loops_per_usec)<0) return -1;
+ if (cfg_number(NULL, "Delay", 0, 1, 1000000000, &loops_per_usec)<0) return -1;
#else
udelay_init();
#endif
- s=cfg_get ("Port",NULL);
+ s=cfg_get (NULL, "Port", NULL);
if (s==NULL || *s=='\0') {
error ("parport: no 'Port' entry in %s", cfg_source());
return -1;
char *s;
snprintf (wire, sizeof(wire), "Wire.%s", name);
- s=cfg_get (wire,deflt);
+ s=cfg_get (NULL, wire, deflt);
if (strcasecmp(s,"STROBE")==0) {
w=PARPORT_CONTROL_STROBE;
} else if(strcasecmp(s,"AUTOFD")==0) {
char *s;
snprintf (wire, sizeof(wire), "Wire.%s", name);
- s=cfg_get (wire,deflt);
+ s=cfg_get (NULL, wire, deflt);
if(strlen(s)==3 && strncasecmp(s,"DB",2)==0 && s[2]>='0' && s[2]<='7') {
w=s[2]-'0';
} else if(strcasecmp(s,"GND")==0) {
-/* $Id: processor.c,v 1.52 2004/01/05 11:57:38 reinelt Exp $
+/* $Id: processor.c,v 1.53 2004/01/09 04:16:06 reinelt Exp $
*
* main data processing
*
*
*
* $Log: processor.c,v $
+ * Revision 1.53 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.52 2004/01/05 11:57:38 reinelt
* added %y tokens to make the Evaluator useable
*
{
static int alarm;
alarm=((alarm+1) % 3);
- if(value < atoi(cfg_get("battwarning","10")) && !alarm) /* flash bar */
+ if(value < atoi(cfg_get(NULL, "battwarning", "10")) && !alarm) /* flash bar */
value = 0;
return value/100;
}
{
int i;
- load.overload=atof(cfg_get("overload","2.0"));
+ load.overload=atof(cfg_get(NULL, "overload", "2.0"));
lcd_query (&rows, &cols, &xres, &yres, &supported_bars, &icons, &gpos);
debug ("Display: %d rows, %d columns, %dx%d pixels, %d icons, %d GPOs", rows, cols, xres, yres, icons, gpos);
- if (cfg_number("Rows", 1, 1, 1000, &lines)<0) {
+ if (cfg_number(NULL, "Rows", 1, 1, 1000, &lines)<0) {
lines=1;
error ("ignoring bad 'Rows' value and using '%d'", lines);
}
lines=ROWS;
}
if (lines>rows) {
- if (cfg_number("Scroll", 1, 1, 1000, &scroll)<0) {
+ if (cfg_number(NULL, "Scroll", 1, 1, 1000, &scroll)<0) {
scroll=1;
error ("ignoring bad 'Scroll' value and using '%d'", scroll);
}
error ("'Scroll' entry in %s is %d, > %d display rows.", cfg_source(), scroll, rows);
error ("This may lead to unexpected results!");
}
- if (cfg_number("Fixed", 0, -1000000, 1000000, &fixed)<0) {
+ if (cfg_number(NULL, "Fixed", 0, -1000000, 1000000, &fixed)<0) {
fixed=0;
error ("ignoring bad 'Fixed' value and using '%d'", fixed);
}
fixed=(fixed<0)? -rows+1 : rows-1;
error ("ignoring bad 'Fixed' value and using '%d'", fixed);
}
- if (cfg_number("Turn", 1000, 1, 1000000, &turn)<0) {
+ if (cfg_number(NULL, "Turn", 1000, 1, 1000000, &turn)<0) {
turn=1000;
error ("ignoring bad 'Scroll' value and using '%d'", turn);
}
fixed=0;
}
- if (cfg_number("Tick.Text", 500, 1, 1000000, &tick_text)<0) {
+ if (cfg_number(NULL, "Tick.Text", 500, 1, 1000000, &tick_text)<0) {
tick_text=500;
error ("ignoring bad 'Tick.Text' value and using '%d'", tick_text);
}
- if (cfg_number("Tick.Bar", 100, 1, 1000000, &tick_bar)<0) {
+ if (cfg_number(NULL, "Tick.Bar", 100, 1, 1000000, &tick_bar)<0) {
tick_bar=100;
error ("ignoring bad 'Tick.Bar' value and using '%d'", tick_bar);
}
- if (cfg_number("Tick.Icon", 100, 1, 1000000, &tick_icon)<0) {
+ if (cfg_number(NULL, "Tick.Icon", 100, 1, 1000000, &tick_icon)<0) {
tick_icon=100;
error ("ignoring bad 'Tick.Icon' value and using '%d'", tick_icon);
}
- if (cfg_number("Tick.GPO", 100, 1, 1000000, &tick_gpo)<0) {
+ if (cfg_number(NULL, "Tick.GPO", 100, 1, 1000000, &tick_gpo)<0) {
tick_gpo=100;
error ("ignoring bad 'Tick.GPO' value and using '%d'", tick_gpo);
}
for (i=1; i<=lines; i++) {
char buffer[8], *p;
snprintf (buffer, sizeof(buffer), "Row%d", i);
- p=cfg_get(buffer,"");
+ p=cfg_get(NULL, buffer, "");
debug ("%s: %s", buffer, p);
row[i]=strdup(parse_row(p, supported_bars, token_usage));
}
for (i=1; i<=gpos; i++) {
char buffer[8], *p;
snprintf (buffer, sizeof(buffer), "GPO%d", i);
- p=cfg_get(buffer,"");
+ p=cfg_get(NULL, buffer, "");
debug ("%s: %s", buffer, p);
gpo[i]=parse_gpo(p, token_usage);
}
-/* $Id: seti.c,v 1.11 2004/01/06 22:33:14 reinelt Exp $
+/* $Id: seti.c,v 1.12 2004/01/09 04:16:06 reinelt Exp $
*
* seti@home specific functions
*
*
*
* $Log: seti.c,v $
+ * Revision 1.12 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.11 2004/01/06 22:33:14 reinelt
* Copyright statements cleaned up
*
time(&now);
if (fd==-2) {
- char *dir=cfg_get("SetiDir",NULL);
+ char *dir=cfg_get(NULL, "SetiDir", NULL);
if (dir==NULL || *dir=='\0') {
error ("no 'SetiDir' entry in %s!\n", cfg_source());
fd=-1;
-/* $Id: system.c,v 1.31 2003/12/01 07:08:51 reinelt Exp $
+/* $Id: system.c,v 1.32 2004/01/09 04:16:06 reinelt Exp $
*
* system status retreivement
*
*
*
* $Log: system.c,v $
+ * Revision 1.32 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.31 2003/12/01 07:08:51 reinelt
*
* Patches from Xavier:
if (fd[index]==-2) {
snprintf(buffer, 32, "Sensor%d", index);
- sensor[index]=cfg_get(buffer, NULL);
+ sensor[index]=cfg_get(NULL, buffer, NULL);
if (sensor[index]==NULL || *sensor[index]=='\0') {
error ("no entry for '%s' in %s", buffer, cfg_source());
fd[index]=-1;
}
snprintf(buffer, 32, "Sensor%d_min", index);
- min_buf[index]=atof(cfg_get(buffer,"0"));
+ min_buf[index]=atof(cfg_get(NULL, buffer, "0"));
*min=min_buf[index];
snprintf(buffer, 32, "Sensor%d_max", index);
- max_buf[index]=atof(cfg_get(buffer,"100"));
+ max_buf[index]=atof(cfg_get(NULL, buffer, "100"));
*max=max_buf[index];
snprintf(buffer, 32, "Sensor%d_factor", index);
- factor_buf[index]=atof(cfg_get(buffer,"1"));
+ factor_buf[index]=atof(cfg_get(NULL, buffer, "1"));
snprintf(buffer, 32, "Sensor%d_offset", index);
- offset_buf[index]=atof(cfg_get(buffer,"0"));
+ offset_buf[index]=atof(cfg_get(NULL, buffer, "0"));
fd[index]=open(sensor[index], O_RDONLY);
if (fd[index]==-1) {
-/* $Id: wifi.c,v 1.4 2004/01/06 22:33:14 reinelt Exp $
+/* $Id: wifi.c,v 1.5 2004/01/09 04:16:06 reinelt Exp $
*
* WIFI specific functions
*
*
*
* $Log: wifi.c,v $
+ * Revision 1.5 2004/01/09 04:16:06 reinelt
+ * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
+ *
* Revision 1.4 2004/01/06 22:33:14 reinelt
* Copyright statements cleaned up
*
char buffer[4096];
char *p;
- char *interface=cfg_get("Wifi.Interface","wlan0");
+ char *interface=cfg_get(NULL, "Wifi.Interface", "wlan0");
*signal=0;
*link=0;