From: Paolo N. <pao...@po...> - 2007-09-12 07:51:03
|
Hi guys, Just to see the bug in another perspective. Does it make sense to have a 8kb debugging output ? Why not just print out the first few bytes of debugging and append a "...\0" string to inform that there is a continuation. As I have understood from Dietmar's original message, the debug information printed was a big netlist, correct ? Ciao, Paolo Dietmar Warning wrote: > Hi Charles, > > I like your solution but some compiler (e.g. MSC) give a "-1" and not > the needed size for howMany if the string is larger then the buffer. > (This seems a known problem of snprintf!) > > Dietmar > > > Charles D.H.Williams schrieb: > >> On Sep 11, 2007, at 20:49, ngs...@li... >> wrote: >> >> >>> out_printf >>> >>> >> My suggestion for a solution to this problem is: >> >> char out_pbuf[BSIZE_SP]; >> >> void out_printf(fmt, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10) >> char *fmt, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10; >> { >> int howMany = snprintf(out_pbuf, sizeof(out_pbuf), fmt, s1, s2, s3, >> s4, s5, s6, s7, s8, s9, s10); >> if (howMany<sizeof(out_pbuf)) { >> out_send(out_pbuf); >> } else { >> char *tbuf = tmalloc(howMany+1); >> snprintf(tbuf, howMany+1, fmt, s1, s2, s3, s4, s5, s6, s7, s8, s9, >> s10); >> out_send(tbuf); >> tfree(tbuf); >> } >> return; >> } >> >> A modification to this would let tbuf persist growing it as necessary. >> (I didn't do this because such behaviour looks like a leak to my >> homespun diagnostics instrumentation.) >> >> Charles >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Ngspice-devel mailing list >> Ngs...@li... >> https://lists.sourceforge.net/lists/listinfo/ngspice-devel >> >> >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Ngspice-devel mailing list > Ngs...@li... > https://lists.sourceforge.net/lists/listinfo/ngspice-devel > |