🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: stdprn problem in Sozobon C -- dlibs

#4203
From: Dale Schumacher
Date: Wed, 20 Sep 1989 09:38
38 lines
2383 bytes
[achowe@tiger.waterloo.edu (anthony howe) writes...]
> I have been having trouble with Sozobon C libraries -- dlibs. It seems
> that if I try and use  stdprn  to send output to the printer like 
> expect then it goes to the screen yet if I open a  PRN:  file and use
> this file stream things work fine. Examples to follow.
> 
> Could Dale Schumacker or someone who may have tried to use  stdprn tell
> me what either I'm doing wrong or if there is library fix I missed.

Ooops.  There _IS_ a bug in main.c in the _iob[] initialization.  I got
the printer and aux handles (the positive, redirectable ones) backwards.
The lines which now read:

/* stdprn */	{0, NULL, NULL, (_IOWRT | _IONBF), 2, 0, '\0'},
/* stdaux */	{0, NULL, NULL, (_IOREAD | _IOWRT | _IONBF), 3, 0, '\0'},

...should instead read:

/* stdprn */	{0, NULL, NULL, (_IOWRT | _IONBF), 3, 0, '\0'},
/* stdaux */	{0, NULL, NULL, (_IOREAD | _IOWRT | _IONBF), 2, 0, '\0'},

One thing to note, however, is that when you open "PRN:" you will
be talking to the negative handle which refers to the device rather
than the positive one associated with the standard stream.  This
may not make any difference to you, but it will make the handles
different even if they _DO_ talk to the same device.

Another issue is that some shells (like the ones which work well with
GCC) may take over handle 2 (which TOS defines as the standard aux) and
use it for standard error (like *NIX).  This would cause output to
handle 2 (previously, stdprn, but stdaux after the "fix") to appear on
the screen!  This sounds part of your problem.

\\   /  Dale Schumacher                         399 Beacon Ave.
 \\ /   (alias: Dalnefre')                      St. Paul, MN  55104-3527
  ><    ...umn-cs!midgard.mn.org!syntel!dal     United States of America
 / \\   "What is wanted is not the will to believe, but the will to find out,
/   \\  which is the exact opposite." -Bertrand Russell
Technical Details
Message-ID: <1989Sep20.093825.13574@stag.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!watmath!att!dptg!rutgers!cs.utexas.edu!uwm.edu!uwvax!umn-d-ub!umn-cs!nis!pwcs!stag!daemon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!watmath!att!dptg!rutgers!cs.utexas.edu!uwm.edu!uwvax!umn-d-ub!umn-cs!nis!pwcs!stag!daemon
From: dal@syntel.mn.org (Dale Schumacher)
Newsgroups: comp.sys.atari.st
Subject: Re: stdprn  problem in Sozobon C -- dlibs
Message-ID: <1989Sep20.093825.13574@stag.UUCP>
Date: 20 Sep 89 09:38:25 GMT
Sender: daemon@stag.UUCP (The devil himself)
Organization: Mindtools ST Access Group
Lines: 38