aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-02-05 04:31:38 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-02-05 04:31:38 +0000
commit06e6b478c4ce9bff2eedd81a6cb42411edf1597b (patch)
treeef4c46056f9b5d43f201f961262f7f6c8287715f
parent74a5130dd4da897be68aa3bb4e8ebb76f280628b (diff)
downloadlcd4linux-06e6b478c4ce9bff2eedd81a6cb42411edf1597b.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 :-) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@177 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--exec.c23
-rw-r--r--processor.c14
2 files changed, 29 insertions, 8 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);
diff --git a/processor.c b/processor.c
index 4e4a0e5..0b37c1e 100644
--- a/processor.c
+++ b/processor.c
@@ -1,4 +1,4 @@
-/* $Id: processor.c,v 1.28 2002/12/05 19:23:01 reinelt Exp $
+/* $Id: processor.c,v 1.29 2003/02/05 04:31:38 reinelt Exp $
*
* main data processing
*
@@ -20,6 +20,11 @@
*
*
* $Log: processor.c,v $
+ * Revision 1.29 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.28 2002/12/05 19:23:01 reinelt
* fixed undefined operations found by gcc3
*
@@ -487,8 +492,12 @@ static void print_token (int token, char **p, char *start, int maxlen)
case T_EXEC:
i = (token>>8)-'0';
*p+=sprintf (*p, "%.*s",cols-(*p-start), exec[i].s);
+#if 0
+ // Fixme: this does not really work as it should...
+ // Remove param 'maxlen' sometimes..
for (i=*p-start; i<cols && maxlen--; i++) /* clear right of text */
*(*p)++=' ';
+#endif
break;
default:
@@ -582,11 +591,14 @@ static char *process_row (int r)
if (*s=='%') {
token = *(unsigned char*)++s;
if (token>T_EXTENDED) token += (*(unsigned char*)++s)<<8;
+#if 0
+ // Fixme: I don't understand this one...
if (!s[1])
len = cols - (s - row[r] - 1);
else
for (q = s+1, len=0; *q && isspace(*q); q++)
len++;
+#endif
print_token (token, &p, buffer, len);
} else if (*s=='$') {