diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-11-23 19:49:11 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-11-23 19:49:11 +0100 |
commit | a784c8f795f60604a2cd6f9633a213e891e4d7df (patch) | |
tree | 2e115572d1bc28243237c5a525548b6a7206d7cd /src/biruda.c | |
parent | 7b6d970a87fbfc2079ba98a26c0b457cc8cd05ee (diff) | |
download | biruda-a784c8f795f60604a2cd6f9633a213e891e4d7df.tar.gz biruda-a784c8f795f60604a2cd6f9633a213e891e4d7df.tar.bz2 |
got to POSTing the start command to the master, now we have to design the messaging below
Diffstat (limited to 'src/biruda.c')
-rw-r--r-- | src/biruda.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/biruda.c b/src/biruda.c index da8b215..685c3ff 100644 --- a/src/biruda.c +++ b/src/biruda.c @@ -411,6 +411,29 @@ static void print_status( ) free( data ); } +static void start_worker( const char *worker_name ) +{ + char url[128]; + snprintf( url, sizeof( url ), "start?op=start&type=worker&name=%s", worker_name ); + char *data = NULL; + int len; + http_retcode ret = http_post( url, "", 0, "Content-Type: text/plain", + &data, &len, NULL ); + if( ret == 200 ) { + if( strlen( data ) > 0 && data[len-1] == '\n' ) { + data[len-1] = '\0'; + len--; + } + if( strlen( data ) > 0 && data[len-1] == '\r' ) { + data[len-1] = '\0'; + } + print_answer( data ); + } else { + print_error( "ERROR: HTTP error %d", ret ); + } + free( data ); +} + static int start_interactive( bool colors ) { char history_filename[1024]; @@ -503,7 +526,7 @@ static int start_interactive( bool colors ) break; case WORKER_PARAM: - printf( "starting worker '%s'\n", line ); + start_worker( line ); command_state = COMMAND; break; } |