Commit b39cf3f2886e3fad7aa6bc1d8f8166d83f278af7

Authored by perry.werneck@gmail.com
1 parent 3ea87533

Melhorando traces na transferência de arquivos

src/include/lib3270/trace.h
@@ -24,7 +24,6 @@ @@ -24,7 +24,6 @@
24 * 24 *
25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) 25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) 26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 * kraucer@bb.com.br (Kraucer Fernandes Mazuco) 27 * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
29 * 28 *
30 */ 29 */
@@ -59,7 +58,7 @@ @@ -59,7 +58,7 @@
59 * @param ... Arguments. 58 * @param ... Arguments.
60 * 59 *
61 */ 60 */
62 - LIB3270_EXPORT void lib3270_write_dstrace(H3270 *session, const char *fmt, ...); 61 + LIB3270_EXPORT void lib3270_write_dstrace(H3270 *session, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
63 62
64 /** 63 /**
65 * Write on trace file. 64 * Write on trace file.
@@ -70,7 +69,7 @@ @@ -70,7 +69,7 @@
70 * @param ... Arguments. 69 * @param ... Arguments.
71 * 70 *
72 */ 71 */
73 - LIB3270_EXPORT void lib3270_write_nettrace(H3270 *session, const char *fmt, ...); 72 + LIB3270_EXPORT void lib3270_write_nettrace(H3270 *session, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
74 73
75 /** 74 /**
76 * Write on trace file. 75 * Write on trace file.
@@ -81,7 +80,7 @@ @@ -81,7 +80,7 @@
81 * @param ... Arguments. 80 * @param ... Arguments.
82 * 81 *
83 */ 82 */
84 - LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...); 83 + LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
85 84
86 #ifdef __cplusplus 85 #ifdef __cplusplus
87 } 86 }
src/lib3270/ft.c
@@ -314,14 +314,14 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -314,14 +314,14 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
314 if(ft->flags & LIB3270_FT_OPTION_RECEIVE) 314 if(ft->flags & LIB3270_FT_OPTION_RECEIVE)
315 { 315 {
316 // Receiving file 316 // Receiving file
317 - lib3270_write_log( ft->host,  
318 - "ft",  
319 - "Receiving file %s %s %s %s",  
320 - ft->local,  
321 - ft->ascii_flag ? "ASCII" : "BINARY",  
322 - ft->cr_flag ? "CRLF" : "NOCRLF",  
323 - ft->remap_flag ? "REMAP" : "NOREMAP"  
324 - ); 317 + lib3270_write_dstrace(
  318 + ft->host,
  319 + "\nReceiving file %s (%s %s %s)\n",
  320 + ft->local,
  321 + ft->ascii_flag ? "ASCII" : "BINARY",
  322 + ft->cr_flag ? "CRLF" : "NOCRLF",
  323 + ft->remap_flag ? "REMAP" : "NOREMAP"
  324 + );
325 } 325 }
326 else 326 else
327 { 327 {
@@ -334,16 +334,16 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -334,16 +334,16 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
334 334
335 ft->length = ftell(ft->local_file); 335 ft->length = ftell(ft->local_file);
336 336
  337 + lib3270_write_dstrace(
  338 + ft->host,
  339 + "\nSending file %s (%ld bytes %s %s %s)\n",
  340 + ft->local,
  341 + ft->length,
  342 + ft->ascii_flag ? "ASCII" : "BINARY",
  343 + ft->cr_flag ? "CRLF" : "NOCRLF",
  344 + ft->remap_flag ? "REMAP" : "NOREMAP"
  345 + );
337 346
338 - lib3270_write_log( ft->host,  
339 - "ft",  
340 - "Sending file %s (%ld bytes) %s %s %s",  
341 - ft->local,  
342 - ft->length,  
343 - ft->ascii_flag ? "ASCII" : "BINARY",  
344 - ft->cr_flag ? "CRLF" : "NOCRLF",  
345 - ft->remap_flag ? "REMAP" : "NOREMAP"  
346 - );  
347 rewind(ft->local_file); 347 rewind(ft->local_file);
348 } 348 }
349 349
src/lib3270/ft_cut.c
@@ -517,7 +517,9 @@ static void cut_data(H3270 *hSession) @@ -517,7 +517,9 @@ static void cut_data(H3270 *hSession)
517 517
518 conv_length = upload_convert(hSession, cvbuf, raw_length); 518 conv_length = upload_convert(hSession, cvbuf, raw_length);
519 if (conv_length < 0) 519 if (conv_length < 0)
  520 + {
520 return; 521 return;
  522 + }
521 523
522 /* Write it to the file. */ 524 /* Write it to the file. */
523 if (fwrite((char *)cvbuf, conv_length, 1, ft->local_file) == 0) 525 if (fwrite((char *)cvbuf, conv_length, 1, ft->local_file) == 0)
src/lib3270/ft_dft.c
@@ -24,9 +24,7 @@ @@ -24,9 +24,7 @@
24 * 24 *
25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) 25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) 26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 * kraucer@bb.com.br (Kraucer Fernandes Mazuco) 27 * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
29 - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)  
30 * 28 *
31 */ 29 */
32 30
@@ -77,18 +75,6 @@ struct data_buffer @@ -77,18 +75,6 @@ struct data_buffer
77 char data[256]; /**< The actual data */ 75 char data[256]; /**< The actual data */
78 }; 76 };
79 77
80 -/* Globals. */  
81 -// int dft_buffersize = 0; /* Buffer size (LIMIN, LIMOUT) */  
82 -  
83 -/* Statics. */  
84 -// static Boolean message_flag = False; /* Open Request for msg received */  
85 -// static int dft_eof;  
86 -// static unsigned long recnum;  
87 -// static char *abort_string = CN;  
88 -// static unsigned char *dft_savebuf = NULL;  
89 -// static int dft_savebuf_len = 0;  
90 -// static int dft_savebuf_max = 0;  
91 -  
92 static void dft_abort(H3270 *hSession, unsigned short code, const char *fmt, ...); 78 static void dft_abort(H3270 *hSession, unsigned short code, const char *fmt, ...);
93 79
94 static void dft_close_request(H3270 *hSession); 80 static void dft_close_request(H3270 *hSession);
src/lib3270/trace_dsc.h
@@ -38,17 +38,12 @@ @@ -38,17 +38,12 @@
38 38
39 const char *rcba(H3270 *session, int baddr); 39 const char *rcba(H3270 *session, int baddr);
40 40
41 -// void toggle_dsTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt);  
42 -// void toggle_eventTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt);  
43 -// void toggle_screenTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt);  
44 -  
45 void trace_ansi_disc(H3270 *hSession); 41 void trace_ansi_disc(H3270 *hSession);
46 void trace_char(H3270 *hSession, char c); 42 void trace_char(H3270 *hSession, char c);
47 void trace_ds(H3270 *hSession, const char *fmt, ...) printflike(2, 3); 43 void trace_ds(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
48 void trace_ds_nb(H3270 *hSession, const char *fmt, ...) printflike(2, 3); 44 void trace_ds_nb(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
49 void trace_dsn(H3270 *hSession, const char *fmt, ...) printflike(2, 3); 45 void trace_dsn(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
50 void trace_screen(H3270 *session); 46 void trace_screen(H3270 *session);
51 -// void trace_rollover_check(void);  
52 47
53 // #define trace_event(...) lib3270_trace_event(&h3270,__VA_ARGS__) 48 // #define trace_event(...) lib3270_trace_event(&h3270,__VA_ARGS__)
54 49