#
-# $Id: README,v 1.2 2000/03/26 19:03:52 reinelt Exp $
+# $Id: README,v 1.3 2000/04/03 04:46:38 reinelt Exp $
#
This is the README file for lcd4linux
vertical bars, logarithmic bars, split bars (two independent bars in one row).
+USAGE
+
+lcd4linux -h
+print version number and a small help text, then exit
+
+lcd4linux -l
+list available drivers
+
+lcd4linux [-c key=val] [-f config-file] [-o output]
+run lcd4linux
+use configuration from 'config-file' instead of /etc/lcd4linux.conf
+write picture to 'output' (raster driver only)
+overwrite entries from the config-file with '-c'
+
+
SUPPORTED DISPLAYS
* Matrox Orbital <http://www.matrixorbital.com>
#
-# $Id: README.Raster,v 1.1 2000/03/26 20:00:44 reinelt Exp $
+# $Id: README.Raster,v 1.2 2000/04/03 04:46:38 reinelt Exp $
#
This is the README file for the Raster display driver for lcd4linux
between this lcd cells by specifying a pixelgap greater than zero.
Sometimes there's a gap between characters, too. You can specify this
gap (in pixels again) horizontally and vertically. Usually this gap
-is the same size as a cell (which is pixelsize+pixelgap).
+is the same size as a cell (which is pixelsize+pixelgap). If you specify
+either the row gap or the column gap as -1, this cell size will be used
+instead.
If you use a font of 5x8, some characters may use the first and the last
pixel. So you should specify a column gap, otherwise the caracters may
#
-# $Id: README.X11,v 1.1 2000/03/28 08:48:33 reinelt Exp $
+# $Id: README.X11,v 1.2 2000/04/03 04:46:38 reinelt Exp $
#
This is the README file for the X11 display driver for lcd4linux
between this lcd cells by specifying a pixelgap greater than zero.
Sometimes there's a gap between characters, too. You can specify this
gap (in pixels again) horizontally and vertically. Usually this gap
-is the same size as a cell (which is pixelsize+pixelgap).
+is the same size as a cell (which is pixelsize+pixelgap). If you specify
+either the row gap or the column gap as -1, this cell size will be used
+instead.
If you use a font of 5x8, some characters may use the first and the last
pixel. So you should specify a column gap, otherwise the caracters may
-/* $Id: cfg.c,v 1.5 2000/03/28 07:22:15 reinelt Exp $
+/* $Id: cfg.c,v 1.6 2000/04/03 04:46:38 reinelt Exp $
*
* config file stuff
*
*
*
* $Log: cfg.c,v $
+ * Revision 1.6 2000/04/03 04:46:38 reinelt
+ *
+ * added '-c key=val' option
+ *
* Revision 1.5 2000/03/28 07:22:15 reinelt
*
* version 0.95 released
/*
* exported functions:
*
+ * cfg_cmd (arg)
+ * allows us to overwrite entries in the
+ * config-file from the command line.
+ * arg is 'key=value'
+ * 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()
typedef struct {
char *key;
char *val;
+ int lock;
} ENTRY;
static char *Config_File=NULL;
static int nConfig=0;
-static char *strip (char *s)
+static char *strip (char *s, int strip_comments)
{
char *p;
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=='\n' || (*p=='#' && (p==s || *(p-1)!='\\'))) {
+ if (*p=='\n' || (strip_comments && *p=='#' && (p==s || *(p-1)!='\\'))) {
*p='\0';
break;
}
return string;
}
-void cfg_set (char *key, char *val)
+static void cfg_add (char *key, char *val, int lock)
{
int i;
for (i=0; i<nConfig; i++) {
if (strcasecmp(Config[i].key, key)==0) {
+ if (Config[i].lock>lock) return;
if (Config[i].val) free (Config[i].val);
Config[i].val=dequote(strdup(val));
return;
Config=realloc(Config, nConfig*sizeof(ENTRY));
Config[i].key=strdup(key);
Config[i].val=dequote(strdup(val));
+ Config[i].lock=lock;
+}
+
+int cfg_cmd (char *arg)
+{
+ char *key, *val;
+ char buffer[256];
+
+ strncpy (buffer, arg, sizeof(buffer));
+ key=strip(buffer, 0);
+ for (val=key; *val; val++) {
+ if (*val=='=') {
+ *val++='\0';
+ break;
+ }
+ }
+ if (*key=='\0' || *val=='\0') return -1;
+ cfg_add (key, val, 1);
+ return 0;
+}
+
+void cfg_set (char *key, char *val)
+{
+ cfg_add (key, val, 0);
}
char *cfg_get (char *key)
Config_File=strdup(file);
while ((line=fgets(buffer,256,stream))!=NULL) {
- if (*(line=strip(line))=='\0') continue;
+ if (*(line=strip(line, 1))=='\0') continue;
for (p=line; *p; p++) {
if (isblank(*p)) {
*p++='\0';
break;
}
}
- p=strip(p);
+ p=strip(p, 1);
if (*p) for (s=p; *(s+1); s++);
else s=p;
if (*p=='"' && *s=='"') {
-/* $Id: cfg.h,v 1.1 2000/03/10 11:40:47 reinelt Exp $
+/* $Id: cfg.h,v 1.2 2000/04/03 04:46:38 reinelt Exp $
*
* config file stuff
*
*
*
* $Log: cfg.h,v $
+ * Revision 1.2 2000/04/03 04:46:38 reinelt
+ *
+ * added '-c key=val' option
+ *
* Revision 1.1 2000/03/10 11:40:47 reinelt
* *** empty log message ***
*
#ifndef _CFG_H_
#define _CFG_H_
+int cfg_cmd (char *arg);
void cfg_set (char *key, char *value);
char *cfg_get (char *key);
int cfg_read (char *file);
-/* $Id: lcd4linux.c,v 1.15 2000/04/01 22:40:42 herp Exp $
+/* $Id: lcd4linux.c,v 1.16 2000/04/03 04:46:38 reinelt Exp $
*
* LCD4Linux
*
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.16 2000/04/03 04:46:38 reinelt
+ *
+ * added '-c key=val' option
+ *
* Revision 1.15 2000/04/01 22:40:42 herp
* geometric correction (too many pixelgaps)
* lcd4linux main should return int, not void
static void usage(void)
{
printf ("%s\n", release);
- printf ("usage: lcd4linux [-h] [-l] [-f config-file] [-o output-file]\n");
+ printf ("usage: lcd4linux [-h] [-l] [-c key=value] [-f config-file] [-o output-file]\n");
}
int main (int argc, char *argv[])
char *driver;
int c, smooth;
- while ((c=getopt (argc, argv, "hlf:o:"))!=EOF) {
+ while ((c=getopt (argc, argv, "c:f:hlo:"))!=EOF) {
switch (c) {
+ case 'c':
+ if (cfg_cmd (optarg)<0) {
+ fprintf (stderr, "%s: illegal argument -c %s\n", argv[0], optarg);
+ exit(2);
+ }
+ break;
case 'h':
usage();
exit(0);
#size 20x4
#font 5x8
#pixel 3+0
-#gap 3x3
+#gap -1x-1
#border 10
#foreground \#102000
#halfground \#70c000
size 20x5
font 5x8
pixel 1+0
-gap 1x1
+gap -1x-1
border 1
foreground \#102000
halfground \#90c000