[freetds] tdsdump functions

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Jul 27 10:44:45 EDT 2004


Considering 

$ grep -r tdsdump_log `find -name \*.c` | grep '%L' | sed 's,"%L,,g' |
grep '%L'
./src/tds/read.c:       tdsdump_log(TDS_DBG_NETWORK, "Received header @
%L\n%D\n", header, sizeof(header));
./src/tds/read.c:       tdsdump_log(TDS_DBG_NETWORK, "Received packet @
%L\n%D\n", tds->in_buf, tds->in_len);
./src/tds/write.c:      tdsdump_log(TDS_DBG_NETWORK, "Sending packet @
%L\n%D\n", tds->out_buf, tds->out_pos);

$ grep -r tdsdump_log `find -name \*.c` | grep '%D'
./src/tds/read.c:       tdsdump_log(TDS_DBG_NETWORK, "Received header @
%L\n%D\n", header, sizeof(header));
./src/tds/read.c:       tdsdump_log(TDS_DBG_NETWORK, "Received packet @
%L\n%D\n", tds->in_buf, tds->in_len);
./src/tds/read.c:
tdsdump_log(TDS_DBG_NETWORK, "\tTroublesome bytes:\n\t%D\n", bufp,
bufleft);
./src/tds/write.c:
tdsdump_log(TDS_DBG_NETWORK, "\tTroublesome bytes:\n\t%D\n", s, (int)
inbytesleft);
./src/tds/write.c:      tdsdump_log(TDS_DBG_NETWORK, "Sending packet @
%L\n%D\n", tds->out_buf, tds->out_pos);

I think it would be better to implement tdsdump_log using vfprintf
(prefixing date/time) and add a message parameter to tdsdump_dump_buf.
So we can use all printf formatting (like %*s or whatever) and gain gcc
check on parameters.

freddy77



More information about the FreeTDS mailing list