summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-06-12 13:49:36 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-06-12 13:49:36 +0200
commit1f53cc0acfc0552172f2b142910f10def4ff0e61 (patch)
tree9f3433d950297b32f6268b74ded3ce2a5f1f78c1
parent71e8567d8a1b4ec4ce07a4dee990c317ee1681d1 (diff)
downloadbiruda-1f53cc0acfc0552172f2b142910f10def4ff0e61.tar.gz
biruda-1f53cc0acfc0552172f2b142910f10def4ff0e61.tar.bz2
temporary checkin
-rw-r--r--TODOS4
-rw-r--r--src/cli.c20
2 files changed, 19 insertions, 5 deletions
diff --git a/TODOS b/TODOS
index d3683d0..788a82f 100644
--- a/TODOS
+++ b/TODOS
@@ -21,5 +21,5 @@
systems? most likely we have to build something on our own. Last resort
is that a biruda on for instance FreeBSD just reboots back to Linux
(one shot grub2 menu entry selection and boot and then falling back)
-
-
+- cli:
+ - have nicer error messages than "ERROR: HTTP error -3
diff --git a/src/cli.c b/src/cli.c
index 3f8f903..aa2d169 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -27,8 +27,9 @@
typedef enum {
COMMAND, // command parsing
- START_WORKER, // worker command expecting a worker parameter
- STOP_WORKER
+ START_WORKER, // worker commands expect a worker (and
+ STOP_WORKER, // optionally an architecture and os parameter)
+ MESSAGES_WORKER
} command_state_t;
static char *commands[] = {
@@ -100,6 +101,11 @@ static void get_workers( )
free( data );
}
+static void print_workers( )
+{
+ puts( "available workers..." );
+}
+
static void completion_func( const char *buf, linenoiseCompletions *lc )
{
unsigned int i;
@@ -118,6 +124,7 @@ static void completion_func( const char *buf, linenoiseCompletions *lc )
case START_WORKER:
case STOP_WORKER:
+ case MESSAGES_WORKER:
get_workers( );
for( int i = 0; i < nof_worker_names; i++ ) {
linenoiseAddCompletion( lc, worker_names[i] );
@@ -301,6 +308,7 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE
case START_WORKER:
case STOP_WORKER:
+ case MESSAGES_WORKER:
context = "worker";
break;
}
@@ -320,6 +328,7 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE
case START_WORKER:
case STOP_WORKER:
+ case MESSAGES_WORKER:
command_state = COMMAND;
continue;
}
@@ -363,7 +372,7 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE
} else if( strncasecmp( line, "stop", 5 ) == 0 ) {
command_state = STOP_WORKER;
} else if( strncasecmp( line, "messages", 8 ) == 0 ) {
- print_messages( );
+ command_state = MESSAGES_WORKER;
} else if( strncasecmp( line, "autodisp", 8 ) == 0 ) {
if( is_interactive ) {
autodisp_toggle = !autodisp_toggle;
@@ -387,6 +396,11 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE
stop_worker( line );
command_state = COMMAND;
break;
+
+ case MESSAGES_WORKER:
+ print_messages( );
+ command_state = COMMAND;
+ break;
}
}