aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile.am3
-rw-r--r--Makefile.in6
-rw-r--r--README26
-rw-r--r--cfg.c53
-rwxr-xr-xconfigure193
-rw-r--r--exec.c66
-rw-r--r--exec.h38
-rw-r--r--parser.c6
-rw-r--r--parser.h10
-rw-r--r--processor.c28
10 files changed, 319 insertions, 110 deletions
diff --git a/Makefile.am b/Makefile.am
index ad090ce..c9186b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,8 @@ filter.c filter.h \
udelay.c udelay.h \
display.c display.h \
pixmap.c pixmap.h \
-fontmap.c fontmap.h
+fontmap.c fontmap.h \
+exec.c exec.h
EXTRA_lcd4linux_SOURCES= \
BeckmannEgle.c \
diff --git a/Makefile.in b/Makefile.in
index 48acdae..3ab5e2e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -76,7 +76,7 @@ lcd4linux_LDFLAGS = $(X_LIBS)
lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@
lcd4linux_DEPENDENCIES = @DRIVERS@
-lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.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 filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h fontmap.c fontmap.h
+lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.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 filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h fontmap.c fontmap.h exec.c exec.h
EXTRA_lcd4linux_SOURCES = BeckmannEgle.c Crystalfontz.c Crystalfontz.h HD44780.c MatrixOrbital.c PalmPilot.c PNG.c PPM.c SIN.c Skeleton.c XWindow.c
@@ -100,7 +100,7 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
lcd4linux_OBJECTS = lcd4linux.o debug.o cfg.o lock.o parser.o \
processor.o system.o isdn.o mail.o seti.o battery.o filter.o udelay.o \
-display.o pixmap.o fontmap.o
+display.o pixmap.o fontmap.o exec.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
@@ -116,7 +116,7 @@ GZIP_ENV = --best
DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/HD44780.P \
.deps/MatrixOrbital.P .deps/PNG.P .deps/PPM.P .deps/PalmPilot.P \
.deps/SIN.P .deps/Skeleton.P .deps/XWindow.P .deps/battery.P \
-.deps/cfg.P .deps/debug.P .deps/display.P .deps/filter.P \
+.deps/cfg.P .deps/debug.P .deps/display.P .deps/exec.P .deps/filter.P \
.deps/fontmap.P .deps/isdn.P .deps/lcd4linux.P .deps/lock.P \
.deps/mail.P .deps/parser.P .deps/pixmap.P .deps/processor.P \
.deps/seti.P .deps/system.P .deps/udelay.P
diff --git a/README b/README
index eb3af90..82dce69 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
#
-# $Id: README,v 1.12 2001/03/02 10:18:45 ltoetsch Exp $
+# $Id: README,v 1.13 2001/03/07 18:10:21 ltoetsch Exp $
#
This is the README file for lcd4linux
@@ -72,8 +72,9 @@ SUPPORTED DISPLAYS
* Raster formats:
a generic raster driver (which is used by the X11-driver, too) is availiable,
- PPM (portable pixmap) is the only output format at the moment. I'm working
- on PNG!
+ it supports:
+ PPM (portable pixmap)
+ PNG (with libgd)
* other displays: lcd4linux and especially the display driver code is very modular,
@@ -90,6 +91,19 @@ A key must not contain whitespace. Keys are NOT case-sensitive. Order doesn't ma
Empty lines and all text on a line after a '#' will be ignored. If you want to
use '#' in a value (think of X11-colors), you have to quote it with a backslash.
+NOTE:
+
+Because of security reasons the config file is assured to be:
+ * - file is a normal file (or /dev/null)
+ * - file owner is owner of program
+ * - file is not writeable by group
+ * - file is not writeable by other
+
+So if you run lcd4linux as root, /etc/lcd4linux has to be:
+ chmod 600
+ chown root.root
+
+
The configuration file contains information for different modules of lcd4linux:
Global options:
@@ -181,3 +195,9 @@ Tokens:
'bp', battery percentage (APM by now)
'bs', battery status ('=' = online, '+' = charging, '-' discharging)
'bd', battery duration in s{econds}, m{ins}, h{ours} or d{ays}
+ 'e*', mails in mailbox 1-9,
+ 'x*', output of command 1-9
+
+Please have a look at lcd4linux.conf.sample, where you can find examples
+of all options.
+
diff --git a/cfg.c b/cfg.c
index 59805b2..89061a2 100644
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.9 2000/08/10 09:44:09 reinelt Exp $
+/* $Id: cfg.c,v 1.10 2001/03/07 18:10:21 ltoetsch Exp $
*
* config file stuff
*
@@ -20,6 +20,9 @@
*
*
* $Log: cfg.c,v $
+ * Revision 1.10 2001/03/07 18:10:21 ltoetsch
+ * added e(x)ec commands
+ *
* Revision 1.9 2000/08/10 09:44:09 reinelt
*
* new debugging scheme: error(), info(), debug()
@@ -108,6 +111,9 @@
#include <ctype.h>
#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
#include "debug.h"
#include "cfg.h"
@@ -209,11 +215,56 @@ char *cfg_get (char *key)
return NULL;
}
+static int check_cfg_file(char *file)
+{
+ /* as passwords and commands are stored in the config file,
+ * we will check that:
+ * - file is a normal file (or /dev/null)
+ * - file owner is owner of program
+ * - file is not writeable by group
+ * - file is not writeable by other
+ */
+
+ uid_t uid, gid;
+ int res;
+ struct stat stbuf;
+
+ uid = geteuid();
+ gid = getegid();
+
+ res = stat(file, &stbuf);
+ if (res == -1) {
+ error ("stat(%s) failed: %s", file, strerror(errno));
+ return -1;
+ }
+ if (S_ISCHR(stbuf.st_mode) && strcmp(file, "/dev/null") == 0)
+ return 0;
+
+ if (!S_ISREG(stbuf.st_mode)) {
+ error ("stat(%s) is not a regular file", file);
+ return -1;
+ }
+ if (stbuf.st_uid != uid || stbuf.st_gid != gid) {
+ error ("stat(%s) owner and/or group don't match", file);
+ return -1;
+ }
+ if (stbuf.st_mode & S_IRWXG || stbuf.st_mode & S_IRWXO) {
+ error ("stat(%s) group or other have access", file);
+ return -1;
+ }
+ return 0;
+}
+
int cfg_read (char *file)
{
FILE *stream;
char buffer[256];
char *line, *p, *s;
+
+ if (check_cfg_file(file) == -1) {
+ error("open(%s) is insecure, we give up", file);
+ exit(2);
+ }
stream=fopen (file, "r");
if (stream==NULL) {
diff --git a/configure b/configure
index 2c8524b..3181489 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
+# Generated automatically using autoconf version 2.14
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -342,7 +342,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
+ echo "configure generated by autoconf version 2.14"
exit 0 ;;
-with-* | --with-*)
@@ -1675,6 +1675,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char gethostbyname();
+char (*f)();
int main() {
@@ -1684,12 +1685,12 @@ int main() {
#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
choke me
#else
-gethostbyname();
+f = gethostbyname;
#endif
; return 0; }
EOF
-if { (eval echo configure:1693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -1710,7 +1711,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1714: checking for gethostbyname in -lnsl" >&5
+echo "configure:1715: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1718,7 +1719,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1722 "configure"
+#line 1723 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1729,7 +1730,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:1733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1759,12 +1760,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1763: checking for connect" >&5
+echo "configure:1764: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1768 "configure"
+#line 1769 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -1773,6 +1774,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char connect();
+char (*f)();
int main() {
@@ -1782,12 +1784,12 @@ int main() {
#if defined (__stub_connect) || defined (__stub___connect)
choke me
#else
-connect();
+f = connect;
#endif
; return 0; }
EOF
-if { (eval echo configure:1791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -1808,7 +1810,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1812: checking for connect in -lsocket" >&5
+echo "configure:1814: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1816,7 +1818,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1820 "configure"
+#line 1822 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1827,7 +1829,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1851,12 +1853,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:1855: checking for remove" >&5
+echo "configure:1857: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1860 "configure"
+#line 1862 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -1865,6 +1867,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char remove();
+char (*f)();
int main() {
@@ -1874,12 +1877,12 @@ int main() {
#if defined (__stub_remove) || defined (__stub___remove)
choke me
#else
-remove();
+f = remove;
#endif
; return 0; }
EOF
-if { (eval echo configure:1883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@@ -1900,7 +1903,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:1904: checking for remove in -lposix" >&5
+echo "configure:1907: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1908,7 +1911,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1912 "configure"
+#line 1915 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1919,7 +1922,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:1923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1943,12 +1946,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:1947: checking for shmat" >&5
+echo "configure:1950: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1952 "configure"
+#line 1955 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -1957,6 +1960,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char shmat();
+char (*f)();
int main() {
@@ -1966,12 +1970,12 @@ int main() {
#if defined (__stub_shmat) || defined (__stub___shmat)
choke me
#else
-shmat();
+f = shmat;
#endif
; return 0; }
EOF
-if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@@ -1992,7 +1996,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:1996: checking for shmat in -lipc" >&5
+echo "configure:2000: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2000,7 +2004,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2004 "configure"
+#line 2008 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2011,7 +2015,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2044,7 +2048,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2048: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2052: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2052,7 +2056,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2056 "configure"
+#line 2060 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2063,7 +2067,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2187,12 +2191,12 @@ DRIVERS="$DRIVERS $RASTER"
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2191: checking for ANSI C header files" >&5
+echo "configure:2195: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2196 "configure"
+#line 2200 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2200,7 +2204,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2217,7 +2221,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2221 "configure"
+#line 2225 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2235,7 +2239,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2239 "configure"
+#line 2243 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2256,7 +2260,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2260 "configure"
+#line 2264 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2267,7 +2271,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2295,12 +2299,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:2299: checking for $ac_hdr that defines DIR" >&5
+echo "configure:2303: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2304 "configure"
+#line 2308 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -2308,7 +2312,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:2312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -2333,7 +2337,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:2337: checking for opendir in -ldir" >&5
+echo "configure:2341: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2341,7 +2345,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2345 "configure"
+#line 2349 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2352,7 +2356,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2374,7 +2378,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:2378: checking for opendir in -lx" >&5
+echo "configure:2382: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2382,7 +2386,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2386 "configure"
+#line 2390 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2393,7 +2397,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:2397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2416,12 +2420,12 @@ fi
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2420: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:2424: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2425 "configure"
+#line 2429 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -2437,7 +2441,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:2441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -2461,17 +2465,17 @@ for ac_hdr in fcntl.h limits.h strings.h sys/ioctl.h sys/time.h syslog.h unistd.
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2465: checking for $ac_hdr" >&5
+echo "configure:2469: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2470 "configure"
+#line 2474 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2475: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2501,17 +2505,17 @@ for ac_hdr in sys/io.h asm/io.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2505: checking for $ac_hdr" >&5
+echo "configure:2509: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2510 "configure"
+#line 2514 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2541,17 +2545,17 @@ for ac_hdr in gd/gd.h gd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2545: checking for $ac_hdr" >&5
+echo "configure:2549: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2550 "configure"
+#line 2554 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2555: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2559: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2581,17 +2585,17 @@ for ac_hdr in net/if_ppp.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2585: checking for $ac_hdr" >&5
+echo "configure:2589: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2590 "configure"
+#line 2594 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2619,12 +2623,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2623: checking for working const" >&5
+echo "configure:2627: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2628 "configure"
+#line 2632 "configure"
#include "confdefs.h"
int main() {
@@ -2673,7 +2677,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2694,21 +2698,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2698: checking for inline" >&5
+echo "configure:2702: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 2705 "configure"
+#line 2709 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2734,12 +2738,12 @@ EOF
esac
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2738: checking for pid_t" >&5
+echo "configure:2742: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2743 "configure"
+#line 2747 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2767,12 +2771,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2771: checking for size_t" >&5
+echo "configure:2775: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2776 "configure"
+#line 2780 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2800,12 +2804,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2804: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2808: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2809 "configure"
+#line 2813 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -2814,7 +2818,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:2818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -2835,12 +2839,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:2839: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:2843: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2844 "configure"
+#line 2848 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -2848,7 +2852,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:2852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2856: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -2869,12 +2873,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2873: checking for uid_t in sys/types.h" >&5
+echo "configure:2877: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2878 "configure"
+#line 2882 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -2905,13 +2909,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:2909: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:2913: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 2915 "configure"
+#line 2919 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -2929,7 +2933,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 2933 "configure"
+#line 2937 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -2951,7 +2955,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2955: checking for 8-bit clean memcmp" >&5
+echo "configure:2959: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2959,7 +2963,7 @@ else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 2963 "configure"
+#line 2967 "configure"
#include "confdefs.h"
main()
@@ -2969,7 +2973,7 @@ main()
}
EOF
-if { (eval echo configure:2973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
@@ -2987,12 +2991,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2991: checking return type of signal handlers" >&5
+echo "configure:2995: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2996 "configure"
+#line 3000 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -3009,7 +3013,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:3013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -3030,12 +3034,12 @@ EOF
for ac_func in gettimeofday select socket strdup strerror strstr strtol uname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3034: checking for $ac_func" >&5
+echo "configure:3038: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3039 "configure"
+#line 3043 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3044,6 +3048,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
+char (*f)();
int main() {
@@ -3053,12 +3058,12 @@ int main() {
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+f = $ac_func;
#endif
; return 0; }
EOF
-if { (eval echo configure:3062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3185,7 +3190,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ echo "$CONFIG_STATUS generated by autoconf version 2.14"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
diff --git a/exec.c b/exec.c
new file mode 100644
index 0000000..0b7edd4
--- /dev/null
+++ b/exec.c
@@ -0,0 +1,66 @@
+/* $Id: exec.c,v 1.1 2001/03/07 18:10:21 ltoetsch Exp $
+ *
+ * exec ('x*') functions
+ *
+ * Copyright 2001 by Leopold Tötsch (lt@toetsch.at)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ * $Log: exec.c,v $
+ * Revision 1.1 2001/03/07 18:10:21 ltoetsch
+ * added e(x)ec commands
+ *
+ *
+ */
+
+#include <stdio.h>
+#include <time.h>
+#include "exec.h"
+#include "debug.h"
+#include "cfg.h"
+
+
+int Exec(int index, char buff[EXEC_TXT_LEN])
+{
+ static time_t now = 0;
+ char *command;
+ char xn[4];
+ FILE *pipe;
+
+ if (time(NULL) <= now+EXEC_WAIT)
+ return 0;
+ time(&now);
+
+ sprintf(xn, "x%d", index);
+ command = cfg_get(xn);
+ debug("command%d = %s:%s",index,xn,command);
+
+ if (!*command) {
+ error("Empty command for 'x%d'", index);
+ return -1;
+ }
+
+ pipe = popen(command, "r");
+ if (pipe == NULL) {
+ error("Couln't run pip '%s'", command);
+ return -1;
+ }
+ fread(buff, EXEC_TXT_LEN, 1, pipe);
+ fclose(pipe);
+ buff[EXEC_TXT_LEN-1] = '\0';
+ return 0;
+}
+
diff --git a/exec.h b/exec.h
new file mode 100644
index 0000000..0bec266
--- /dev/null
+++ b/exec.h
@@ -0,0 +1,38 @@
+/* $Id: exec.h,v 1.1 2001/03/07 18:10:21 ltoetsch Exp $
+ *
+ * exec ('x*') functions
+ *
+ * Copyright 2001 by Leopold Tötsch (lt@toetsch.at)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ * $Log: exec.h,v $
+ * Revision 1.1 2001/03/07 18:10:21 ltoetsch
+ * added e(x)ec commands
+ *
+ *
+ */
+
+#ifndef _EXEC_H
+#define _EXEC_H_
+
+#define EXECS 9
+#define EXEC_WAIT 2
+#define EXEC_TXT_LEN 256
+
+int Exec (int index, char txt[EXEC_TXT_LEN]);
+
+#endif
diff --git a/parser.c b/parser.c
index fb3f3be..3c7482a 100644
--- a/parser.c
+++ b/parser.c
@@ -1,4 +1,4 @@
-/* $Id: parser.c,v 1.11 2001/03/02 10:18:03 ltoetsch Exp $
+/* $Id: parser.c,v 1.12 2001/03/07 18:10:21 ltoetsch Exp $
*
* row definition parser
*
@@ -20,6 +20,9 @@
*
*
* $Log: parser.c,v $
+ * Revision 1.12 2001/03/07 18:10:21 ltoetsch
+ * added e(x)ec commands
+ *
* Revision 1.11 2001/03/02 10:18:03 ltoetsch
* added /proc/apm battery stat
*
@@ -153,6 +156,7 @@ static SYMTAB Symtab[] = {{ "%", T_PERCENT, C_GENERIC, 0 },
{ "bd", T_BATT_DUR, C_BATT, 0 },
{ "e*", T_MAIL, C_MAIL, 0 },
{ "s*", T_SENSOR, C_SENSOR, 1 },
+ { "x*", T_EXEC, C_EXEC, 0 },
{ "", -1, 0 }};
static int bar_type (char tag)
diff --git a/parser.h b/parser.h
index ecc4e4b..7332b4c 100644
--- a/parser.h
+++ b/parser.h
@@ -1,4 +1,4 @@
-/* $Id: parser.h,v 1.9 2001/03/02 10:18:03 ltoetsch Exp $
+/* $Id: parser.h,v 1.10 2001/03/07 18:10:21 ltoetsch Exp $
*
* row definition parser
*
@@ -20,6 +20,9 @@
*
*
* $Log: parser.h,v $
+ * Revision 1.10 2001/03/07 18:10:21 ltoetsch
+ * added e(x)ec commands
+ *
* Revision 1.9 2001/03/02 10:18:03 ltoetsch
* added /proc/apm battery stat
*
@@ -82,13 +85,14 @@ typedef enum {
T_BATT_PERC, T_BATT_STAT, T_BATT_DUR,
T_EXTENDED,
T_MAIL,
- T_SENSOR
+ T_SENSOR,
+ T_EXEC
} TOKEN;
typedef enum {
C_GENERIC, C_MEM, C_LOAD, C_CPU, C_DISK, C_ETH, C_PPP, C_ISDN, C_SETI,
C_BATT,
- C_MAIL, C_SENSOR
+ C_MAIL, C_SENSOR, C_EXEC
} CLASS;
char *parse_row (char *string, int supported_bars, int usage[]);
diff --git a/processor.c b/processor.c
index aa320c6..e65b475 100644
--- a/processor.c
+++ b/processor.c
@@ -1,4 +1,4 @@
-/* $Id: processor.c,v 1.15 2001/03/02 10:18:03 ltoetsch Exp $
+/* $Id: processor.c,v 1.16 2001/03/07 18:10:21 ltoetsch Exp $
*
* main data processing
*
@@ -20,6 +20,9 @@
*
*
* $Log: processor.c,v $
+ * Revision 1.16 2001/03/07 18:10:21 ltoetsch
+ * added e(x)ec commands
+ *
* Revision 1.15 2001/03/02 10:18:03 ltoetsch
* added /proc/apm battery stat
*
@@ -118,6 +121,7 @@
#include "mail.h"
#include "battery.h"
#include "seti.h"
+#include "exec.h"
#define ROWS 16
#define GPOS 16
@@ -138,7 +142,7 @@ struct { int perc, stat; double dur; } batt;
struct { double perc, cput; } seti;
struct { int num; } mail[MAILBOXES];
struct { double val, min, max; } sensor[SENSORS];
-
+struct { char s[EXEC_TXT_LEN]; } exec[EXECS];
static double query (int token)
{
@@ -307,6 +311,7 @@ static double query_bar (int token)
static void print_token (int token, char **p)
{
double val;
+ int i;
switch (token) {
case T_PERCENT:
@@ -429,13 +434,22 @@ static void print_token (int token, char **p)
*p+=sprintf(*p, "%2.0f%c", val, eh);
}
break;
-
+
+#if 0
+ never comes here -lt ?
case T_MAIL:
val=query(token);
*p+=sprintf (*p, "%3.0f", val);
break;
+#endif
+
default:
- *p+=sprintf (*p, "%5.0f", query(token));
+ if ((token & 255) == T_EXEC) {
+ i = (token>>8)-'0';
+ *p+=sprintf (*p, "%s", exec[i].s);
+ }
+ else
+ *p+=sprintf (*p, "%5.0f", query(token));
}
}
@@ -504,6 +518,12 @@ static void collect_data (void)
Sensor (i, &sensor[i].val, &sensor[i].min, &sensor[i].max);
}
}
+
+ for (i=1; i<EXECS; i++) {
+ if (token_usage[T_EXEC]&(1<<i)) {
+ Exec (i, &exec[i].s);
+ }
+ }
}
static char *process_row (int r)