[Refdb-cvs] CVS: refdb/src refdbib.c,1.41.2.9,1.41.2.10
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2006-02-08 20:45:34
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5919 Modified Files: Tag: Release_0_9_5_stable refdbib.c Log Message: use read_terminated_string() in one more location Index: refdbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbib.c,v retrieving revision 1.41.2.9 retrieving revision 1.41.2.10 diff -u -U2 -r1.41.2.9 -r1.41.2.10 --- refdbib.c 5 Feb 2006 01:39:41 -0000 1.41.2.9 +++ refdbib.c 8 Feb 2006 20:45:25 -0000 1.41.2.10 @@ -530,4 +530,5 @@ int n_result; int i; + int n_error; int n_xmlfile_done = 0; int n_chunk_count = 0; @@ -640,6 +641,4 @@ if (cs_status == 402) { - int n_error; - if (stylespec_dir && *stylespec_dir) { strcpy(specfile, stylespec_dir); @@ -670,4 +669,7 @@ if (n_error) { + free(slvals.outbuffer); + close_outfile(specfilefp); + n_broken_pipe = 0; return 1; } @@ -802,5 +804,4 @@ do { /* read in loop over all chunks of data the server is going to send */ - int n_error; if ((cs_status = read_status(slvals.n_sockfd)) == 402) { @@ -821,4 +822,6 @@ if (n_error) { + closepager(pagerfp); + n_broken_pipe = 0; return 1; } @@ -891,52 +894,62 @@ } - /* read summary in loop */ - n_read_done = 0; + byte_written += read_terminated_string(&slvals, stderr, &n_error); - do { /* loop until we've got a complete dataset */ - numbyte = tread(slvals.n_sockfd, inbuffer, COMMAND_INBUF_LEN); - /* printf("numbyte:%d\n", numbyte); */ - if (numbyte == -1) { - fprintf(stderr, get_status_msg(109)); - fprintf(stderr, "\n"); - LOG_PRINT(LOG_WARNING, get_status_msg(109)); - free(slvals.outbuffer); - close(slvals.n_sockfd); - closepager(pagerfp); - n_broken_pipe = 0; - return 1; - } + if (n_error) { + free(slvals.outbuffer); + close(slvals.n_sockfd); + closepager(pagerfp); + n_broken_pipe = 0; + return 1; + } - n_curr_trailing_z = get_trailz(inbuffer, numbyte); - - if (numbyte >= TERM_LEN) { - if (n_curr_trailing_z >= TERM_LEN) { - n_read_done++; - } - } - else if (n_curr_trailing_z == numbyte - && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { - n_read_done++; - } - else if (n_curr_trailing_z == numbyte) { - /* terminator is still incomplete */ - n_last_trailing_z += n_curr_trailing_z; - continue; - } +/* /\* read summary in loop *\/ */ +/* n_read_done = 0; */ - /* write numbyte chars to output, unless this is the last chunk: we do not - want to write the terminating \0 */ - if (!n_broken_pipe) { - if (n_last_trailing_z) { - byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, stderr); - } - byte_written += fwrite(inbuffer, sizeof(char), numbyte-n_curr_trailing_z, stderr); - } +/* do { /\* loop until we've got a complete dataset *\/ */ +/* numbyte = tread(slvals.n_sockfd, inbuffer, COMMAND_INBUF_LEN); */ +/* /\* printf("numbyte:%d\n", numbyte); *\/ */ +/* if (numbyte == -1) { */ +/* fprintf(stderr, get_status_msg(109)); */ +/* fprintf(stderr, "\n"); */ +/* LOG_PRINT(LOG_WARNING, get_status_msg(109)); */ +/* free(slvals.outbuffer); */ +/* close(slvals.n_sockfd); */ +/* closepager(pagerfp); */ +/* n_broken_pipe = 0; */ +/* return 1; */ +/* } */ - if (!n_read_done) { - n_last_trailing_z = n_curr_trailing_z; - } +/* n_curr_trailing_z = get_trailz(inbuffer, numbyte); */ + +/* if (numbyte >= TERM_LEN) { */ +/* if (n_curr_trailing_z >= TERM_LEN) { */ +/* n_read_done++; */ +/* } */ +/* } */ +/* else if (n_curr_trailing_z == numbyte */ +/* && n_curr_trailing_z + n_last_trailing_z >= TERM_LEN) { */ +/* n_read_done++; */ +/* } */ +/* else if (n_curr_trailing_z == numbyte) { */ +/* /\* terminator is still incomplete *\/ */ +/* n_last_trailing_z += n_curr_trailing_z; */ +/* continue; */ +/* } */ + +/* /\* write numbyte chars to output, unless this is the last chunk: we do not */ +/* want to write the terminating \0 *\/ */ +/* if (!n_broken_pipe) { */ +/* if (n_last_trailing_z) { */ +/* byte_written += fwrite(cs_term, sizeof(char), n_last_trailing_z, stderr); */ +/* } */ +/* byte_written += fwrite(inbuffer, sizeof(char), numbyte-n_curr_trailing_z, stderr); */ +/* } */ + +/* if (!n_read_done) { */ +/* n_last_trailing_z = n_curr_trailing_z; */ +/* } */ - } while (!n_read_done); +/* } while (!n_read_done); */ /* send back confirmation to the server */ |