[comp.lang.c] What is _sobuf and wher is it defined?

shodsdon@elrond.CalComp.COM (Steve V. Hodsdon) (07/26/90)

I am trying to port rcs, version 3, to a Sun SPARCserver. The rdiff
directory is the only one that is giving me problems. All three files
compile with no warnings, but when the loading is done, there is an
undefined symbol: __sobuf.

        Loading rdiff ... ld: Undefined symbol
           __sobuf
        *** Error code 1

This same code will compile on a VAX and a MIPS machine with no
problems. The problem is, I can't find any reference to _sobuf in the
manuals, man pages, or grep.

The code can be found in diff.c:

	[outside of main ...]

	extern  char _sobuf[];


	[ inside main ...]

		setbuf(stdout, _sobuf);

Other info: SunOS 4.0.3, VAX-Ultrix V2.2, MIPS-UMIPS-BSD V2.1

Thanks for any insight that you can give me.

-- 
Steve Hodsdon                          | Stay sane inside insanity.
shodsdon@elrond.CalComp.COM            | Don't dream it -  Be it.
{decvax|harvard}!elrond!shodsdon       |
(603) 885-8324                         |

henry@zoo.toronto.edu (Henry Spencer) (07/27/90)

In article <2855@elrond.CalComp.COM> shodsdon@elrond.CalComp.COM (Steve V. Hodsdon) writes:
>I am trying to port rcs, version 3, to a Sun SPARCserver. The rdiff
>directory is the only one that is giving me problems. All three files
>compile with no warnings, but when the loading is done, there is an
>undefined symbol: __sobuf.

Ugh.  _sobuf is part of the innards of the original implementation of stdio.
Whatever pinhead wrote this code was doing things he had no business doing.
-- 
NFS:  all the nice semantics of MSDOS, | Henry Spencer at U of Toronto Zoology
and its performance and security too.  |  henry@zoo.toronto.edu   utzoo!henry

guy@auspex.auspex.com (Guy Harris) (07/28/90)

>I am trying to port rcs, version 3, to a Sun SPARCserver.

Get Version 4 instead.  There are some bugs in the R3 version that
prevent it from running on machines that disallow dereferencing of NULL
pointers, such as Suns of all flavors, and other bugs that prevent it
from running on machines that don't pass arguments the "conventional"
way, such as SPARC-based machines.  They are fixed in R4.

As for "_sobuf", it's an unfortunately-too-widely-known internal
variable of *some*, but not *all*, standard I/O implementations.  It's
not documented because it's an internal variable; it's used because UNIX
programmers are often undisciplined and have read the source and "know"
what's in the implementation.