From 2397642e4be06a891f1f532bf611af3929e51301 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 20 Apr 2005 20:48:50 +0000 Subject: [PATCH] slimmed a chunk of code git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@289 9efc2488-bf62-4759-914b-345cdb29e865 --- src/srfsh/srfsh.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index e24e5b3..8594fd1 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -32,11 +32,11 @@ int main( int argc, char* argv[] ) { client = osrf_system_get_transport_client(); + osrf_message_set_json_parse(1); /* main process loop */ char* request; - //signal(SIGINT,sig_int_handler); while((request=readline(prompt))) { if( !strcmp(request, "exit") || !strcmp(request,"quit")) @@ -461,18 +461,17 @@ int send_request( char* server, osrf_message_free(last_result); last_result = omsg; - if( pretty_print ) { - char* content = json_printer( omsg->result_content ); - buffer_add( resp_buffer, "\nReceived Data: " ); - buffer_add( resp_buffer, content ); - buffer_add( resp_buffer, "\n" ); - free(content); - } else { - char* content = json_object_get_string(omsg->result_content); - buffer_add( resp_buffer, "\nReceived Data: " ); - buffer_add( resp_buffer, content ); - buffer_add( resp_buffer, "\n" ); - } + char* content; + + if( pretty_print ) + content = json_printer( omsg->result_content ); + else + content = json_object_get_string(omsg->result_content); + + buffer_add( resp_buffer, "\nReceived Data: " ); + buffer_add( resp_buffer, content ); + buffer_add( resp_buffer, "\n" ); + free(content); } else { @@ -492,7 +491,6 @@ int send_request( char* server, } - double end = get_timestamp_millis(); fprintf( less, resp_buffer->buf ); -- 2.11.0