🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #5289

Re: Which filehandle for stderr?

#5289
From: Allan Pratt
Date: Wed, 25 Oct 1989 21:15
55 lines
2243 bytes
piet@cs.ruu.nl (Piet van Oostrum) writes:

>Which filehandle should be used for stderr? I have seen compilers that use
>2 and others that use -1.

>If you use 2: you can redirect stderr, but it is not official TOS usage (2
>is supposed to be stdaux). So you need a sheel that sets up 2 to default to
>the console. On the other hand it is Unix compatible.

>If you use -1: it is TOS standard, compatible with the desktop, but you
>can't redirect it to a file.

Boy, if only all the questions on the net were this well thought out
and concise.  Way to go, Piet!

My personal opinion, not to be construed as an Atari policy statement,
is that handle 2 is a fine choice.  I realize it requires a shell which
supports it, but I think it's worth the effort. You can even tell if
you've been run from the Desktop, and if you are, you Fforce handle 2
to -1 or something.

(You can tell if you're launched from the Desktop by checking for a CR
character just PAST the end of your command line.  It's not very nice,
but it works.  Here's the code you'd have to use in your startup,
before anybody munges the command line.)

----------------------------------------

	move.l	<basepage>,a0
	lea.l	$80(a0),a0
	move.b	(a0)+,d0
	ext.w	d0
	cmp.b	#$d,(d0,a0)
	bne	notdesktop

	... launched from desktop ...

	bra	done

notdesktop:

	... not launched from desktop ...

done:

----------------------------------------

Of course, if your shell puts a CR there in a misguided attempt at
being compatible with the desktop, you'll be in trouble. Another way to
tell is to see if there's anything but PATH in your environment: most
shells put SOMETHING there...

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt
Technical Details
Message-ID: <1748@atari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!portal!atari!apratt
References: <1739@ruuinf.cs.ruu.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!portal!atari!apratt
From: apratt@atari.UUCP (Allan Pratt)
Newsgroups: comp.sys.atari.st
Subject: Re: Which filehandle for stderr?
Message-ID: <1748@atari.UUCP>
Date: 25 Oct 89 21:15:21 GMT
References: <1739@ruuinf.cs.ruu.nl>
Organization: Atari Corp., Sunnyvale CA
Lines: 55