From: Thadeu Lima de Souza Cascardo Date: Fri, 14 Jun 2013 11:53:25 +0000 (-0300) Subject: Just to be safe, show message and try to save file. X-Git-Tag: v0.1~1 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Flibreceita.git;a=commitdiff_plain;h=2459755a51dfddf1217c270efe87074e669a35e7 Just to be safe, show message and try to save file. When we receive a response we are not sure how to handle, try to find a message and a file in the response and use them. --- diff --git a/rnetclient.c b/rnetclient.c index df46b79..53c1fbf 100644 --- a/rnetclient.c +++ b/rnetclient.c @@ -247,7 +247,7 @@ out: umask(mask); } -static void handle_response_already_found(char *cpf, struct rnet_message *message) +static void handle_response_text_and_file(char *cpf, struct rnet_message *message) { char *value; int vlen; @@ -257,6 +257,11 @@ static void handle_response_already_found(char *cpf, struct rnet_message *messag save_rec_file(cpf, value, vlen); } +static void handle_response_already_found(char *cpf, struct rnet_message *message) +{ + handle_response_text_and_file(cpf, message); +} + static void handle_response_error(struct rnet_message *message) { char *value; @@ -318,6 +323,7 @@ int main(int argc, char **argv) } switch (message->buffer[0]) { case 1: /* go ahead */ + handle_response_text_and_file(cpf, message); break; case 3: /* error */ handle_response_error(message); @@ -329,6 +335,7 @@ int main(int argc, char **argv) break; case 2: case 5: + handle_response_text_and_file(cpf, message); finish = 1; break; } @@ -354,6 +361,7 @@ int main(int argc, char **argv) case 4: case 5: case 1: + handle_response_text_and_file(cpf, message); break; }