Re: [HACKERS] pg_dump return status..

2001-01-09 Thread Bruce Momjian
> There are two versions of sprintf() available in SunOS 4 - 8. The > standard one (ANSI C) in libc returns an int, the number of characters > written (excluding '\0'). The BSD version returns a char* which > points to the target. If you have a -lbsd on your link line then you > get the BSD ver

Re: [HACKERS] pg_dump return status..

2001-01-08 Thread Tom Lane
Pete Forman <[EMAIL PROTECTED]> writes: > Philip Warner writes: >> All I need to know is how to detect an error. Does it return EOF on >> error? > The standard sprintf() returns a negative int on error. I thought we were talking about fprintf. sprintf can't really detect any errors anyway, exce

Re: [HACKERS] pg_dump return status..

2001-01-08 Thread Pete Forman
Philip Warner writes: > At 09:36 8/01/01 +, Pete Forman wrote: > >There are no compiler errors, just run time errors if you rely on > >the return from sprintf() being the number of characters. > > All I need to know is how to detect an error. Does it return EOF on > error? The standard

Re: [HACKERS] pg_dump return status..

2001-01-08 Thread Philip Warner
At 09:36 8/01/01 +, Pete Forman wrote: >There are no compiler errors, just run time >errors if you rely on the return from sprintf() being the number of >characters. All I need to know is how to detect an error. Does it return EOF on error? --

Re: [HACKERS] pg_dump return status..

2001-01-08 Thread Pete Forman
Nathan Myers writes: > On Fri, Jan 05, 2001 at 11:20:43AM -0500, Tom Lane wrote: > > Philip Warner <[EMAIL PROTECTED]> writes: > > > how do I > > > check for a failed write in a way that works on all Unixes? Is the > > > following OK: > > > > > - fwrite: ok if return value equals item coun

Re: [HACKERS] pg_dump return status..

2001-01-05 Thread Tom Lane
>> An fprintf returning 0 is a suspicious event; it's easy to imagine >> cases where it makes sense, but I don't think I have ever coded one. >> Probably > N (where N is the smallest reasonable output, defaulting >> to 1) may be a better test in real code. > On older systems fprintf returns 0 o

Re: [HACKERS] pg_dump return status..

2001-01-05 Thread Ian Lance Taylor
[EMAIL PROTECTED] (Nathan Myers) writes: > An fprintf returning 0 is a suspicious event; it's easy to imagine > cases where it makes sense, but I don't think I have ever coded one. > Probably >N (where N is the smallest reasonable output, defaulting > to 1) may be a better test in real code. O