aboutsummaryrefslogtreecommitdiffstats
path: root/lcd4linux.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-14 07:11:42 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-14 07:11:42 +0000
commit1a6167b7b7e7223edd2a5bee630bd21eefae6446 (patch)
tree3fdd7b84e99849e1a2abf763d3180f5fb50f7e02 /lcd4linux.c
parent924eabb9cef6589471dc568c01402a64d27e0476 (diff)
downloadlcd4linux-1a6167b7b7e7223edd2a5bee630bd21eefae6446.tar.gz
[lcd4linux @ 2004-03-14 07:11:42 by reinelt]
parameter count fixed for plugin_dvb() plugin_APM (battery status) ported git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@401 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'lcd4linux.c')
-rw-r--r--lcd4linux.c69
1 files changed, 44 insertions, 25 deletions
diff --git a/lcd4linux.c b/lcd4linux.c
index cd48c99..7e44a69 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.68 2004/03/11 06:39:59 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.69 2004/03/14 07:11:42 reinelt Exp $
*
* LCD4Linux
*
@@ -22,6 +22,10 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.69 2004/03/14 07:11:42 reinelt
+ * parameter count fixed for plugin_dvb()
+ * plugin_APM (battery status) ported
+ *
* Revision 1.68 2004/03/11 06:39:59 reinelt
* big patch from Martin:
* - reuse filehandles
@@ -410,6 +414,34 @@ int hello (void)
}
#endif
+
+static void interactive_mode (void)
+{
+ char line[1024];
+ void *tree;
+ RESULT result = {0, 0, 0, NULL};
+
+ printf("\neval> ");
+ for(fgets(line, 1024, stdin); !feof(stdin); fgets(line, 1024, stdin)) {
+ if (line[strlen(line)-1]=='\n') line[strlen(line)-1]='\0';
+ if (strlen(line)>0) {
+ if (Compile(line, &tree)!=-1) {
+ Eval (tree, &result);
+ if (result.type==R_NUMBER) {
+ printf ("%g\n", R2N(&result));
+ } else if (result.type==R_STRING) {
+ printf ("'%s'\n", R2S(&result));
+ }
+ DelResult (&result);
+ }
+ DelTree(tree);
+ }
+ printf("eval> ");
+ }
+ printf ("\n");
+}
+
+
void handler (int signal)
{
debug ("got signal %d", signal);
@@ -563,6 +595,14 @@ int main (int argc, char *argv[])
running_background=1;
}
+ // go into interactive mode before display initialization
+ if (interactive >= 2) {
+ interactive_mode();
+ pid_exit(PIDFILE);
+ cfg_exit();
+ exit (0);
+ }
+
debug ("initializing driver %s", driver);
if (drv_init(section, driver)==-1) {
pid_exit(PIDFILE);
@@ -580,30 +620,9 @@ int main (int argc, char *argv[])
layout_init(layout);
free(layout);
- // maybe go into interactive mode
- if (interactive) {
- char line[1024];
- void *tree;
- RESULT result = {0, 0, 0, NULL};
-
- printf("\neval> ");
- for(fgets(line, 1024, stdin); !feof(stdin); fgets(line, 1024, stdin)) {
- if (line[strlen(line)-1]=='\n') line[strlen(line)-1]='\0';
- if (strlen(line)>0) {
- if (Compile(line, &tree)!=-1) {
- Eval (tree, &result);
- if (result.type==R_NUMBER) {
- printf ("%g\n", R2N(&result));
- } else if (result.type==R_STRING) {
- printf ("'%s'\n", R2S(&result));
- }
- DelResult (&result);
- }
- DelTree(tree);
- }
- printf("eval> ");
- }
- printf ("\n");
+ // go into interactive mode (display has been initialized)
+ if (interactive >= 1) {
+ interactive_mode();
drv_quit();
pid_exit(PIDFILE);
cfg_exit();