aboutsummaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorreinelt <>2003-02-05 04:31:38 +0000
committerreinelt <>2003-02-05 04:31:38 +0000
commit63d02170e5c62d7697acdbf551a37a3576ec35f5 (patch)
treeef4c46056f9b5d43f201f961262f7f6c8287715f /exec.c
parent1561dee84acfbaa867b6903188fec991d2ef4b57 (diff)
downloadlcd4linux-63d02170e5c62d7697acdbf551a37a3576ec35f5.tar.gz
[lcd4linux @ 2003-02-05 04:31:38 by reinelt]
T_EXEC: remove trailing CR/LF T_EXEC: deactivated maxlen calculation (for I don't understand what it is for :-)
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/exec.c b/exec.c
index 732ac04..b3481d8 100644
--- a/exec.c
+++ b/exec.c
@@ -1,4 +1,4 @@
-/* $Id: exec.c,v 1.7 2002/04/29 11:00:28 reinelt Exp $
+/* $Id: exec.c,v 1.8 2003/02/05 04:31:38 reinelt Exp $
*
* exec ('x*') functions
*
@@ -20,6 +20,11 @@
*
*
* $Log: exec.c,v $
+ * Revision 1.8 2003/02/05 04:31:38 reinelt
+ *
+ * T_EXEC: remove trailing CR/LF
+ * T_EXEC: deactivated maxlen calculation (for I don't understand what it is for :-)
+ *
* Revision 1.7 2002/04/29 11:00:28 reinelt
*
* added Toshiba T6963 driver
@@ -100,7 +105,6 @@ int Exec(int index, char buff[EXEC_TXT_LEN], double *val)
else {
sprintf(xn, "Delay_x%d", index);
/* delay in Delay_x* sec ? */
- debug ("%s=%s",xn,cfg_get(xn));
if (time(NULL) <= now[index] + atoi(cfg_get(xn)?:"1")) {
return 0;
}
@@ -111,7 +115,6 @@ int Exec(int index, char buff[EXEC_TXT_LEN], double *val)
sprintf(xn, "x%d", index);
command = cfg_get(xn);
- debug("%s:'%s'",xn,command);
if (!command || !*command) {
error("Empty command for 'x%d'", index);
@@ -139,11 +142,17 @@ int Exec(int index, char buff[EXEC_TXT_LEN], double *val)
}
pclose(pipe);
buff[len] = '\0';
- for (p = buff ; *p && isspace(*p); p++)
- ;
- if (isdigit(*p)) {
+
+ // remove trailing CR/LF
+ while (buff[len-1]=='\n' || buff[len-1]=='\r') {
+ buff[--len]='\0';
+ }
+
+ debug("%s: <%s> = '%s'",xn,command,buff);
+
+ if (isdigit(*buff)) {
double max, min;
- *val = atof(p);
+ *val = atof(buff);
sprintf(xn, "Max_x%d", index);
max = atof(cfg_get(xn)?:"100")?:100;
sprintf(xn, "Min_x%d", index);