Re: pg_dump return status..

From: Pete Forman <pete(dot)forman(at)westerngeco(dot)com>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump return status..
Date: 2001-01-08 11:16:00
Message-ID: 14937.41328.109146.47030@kryten.bedford.waii.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Philip Warner writes:
> At 09:36 8/01/01 +0000, 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 sprintf() returns a negative int on error. That value
may or may not be EOF. EOF technically indicates the end of an input
stream. It has no direct connection with errors writing to streams.

The "BSD" version in Solaris always returns the char* pointer that is
the first argument. There is no way to check for an error.

Other BSD OSs such as FreeBSD, NetBSD and OpenBSD all conform to C89,
i.e. sprintf() returns an int which is the number of characters
written (excluding '\0') or a negative number for failure.
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete(dot)forman(at)westerngeco(dot)com -./\.- opinion of Schlumberger, Baker
http://www.crosswinds.net/~petef -./\.- Hughes or their divisions.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gordan Bobic 2001-01-08 11:19:49 Re: Version 7.1 when??
Previous Message Philip Warner 2001-01-08 10:30:53 Re: pg_dump return status..

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2001-01-08 11:32:53 Re: patch: contrib/pgcrypto sanity
Previous Message Philip Warner 2001-01-08 10:30:53 Re: pg_dump return status..