🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #8324

Re: PS libraries

#8324
From: Russ Nelson
Date: Mon, 01 May 1989 04:42
42 lines
1757 bytes
In article <98@snll-arpagw.UUCP> paolucci@snll-arpagw.UUCP (Sam Paolucci) writes:

   In article <783@adobe.UUCP> greid@adobe.COM (Glenn Reid) writes:
   ->Anyway, forgive my impatience with the ^D issue.  It is a plague on
   ->portability and on the world.

   Also if the output is redirected to a file, and later the PC
   user decides to copy the file directly to the serial device, again we
   have no end of file.

#include <stdio.h>
#include <gnu_general_license.h>

#define PRINTER	"prn"

main()
{
	int c;
	FILE *printer;

	if ((printer = fopen(PRINTER,"w")) == NULL) {
		fprintf(stderr, "Uh-oh, you don't have a printer.");
		exit(1);
	}
	while ((c = getc(stdin)) != EOF) {
		putc(c, printer);
	}
	putc(4, printer);
	fclose(printer);
}

Problem solved.  Now you just have to teach your applications that emit
PS to append a ^D if stdout is a device.  On MS-LOSS it looks something
like this:

	if (isatty(stdout))
		putc(4, stdout);

--
--russ (nelson@clutx [.bitnet | .clarkson.edu])
I'm a right-to-lifer -- everyone has a right to earn a living sufficient to
feed himself and his family.
Technical Details
Message-ID: <NELSON.89May1004223@sun.soe.clarkson.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!sun.soe.clarkson.edu!nelson
References: <2994@daisy.UUCP> <775@adobe.UUCP> <8751@polya.Stanford.EDU> <783@adobe.UUCP> <98@snll-arpagw.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!sun.soe.clarkson.edu!nelson
From: nelson@sun.soe.clarkson.edu (Russ Nelson)
Newsgroups: comp.lang.postscript
Subject: Re: PS libraries
Message-ID: <NELSON.89May1004223@sun.soe.clarkson.edu>
Date: 1 May 89 04:42:23 GMT
References: <2994@daisy.UUCP> <775@adobe.UUCP> <8751@polya.Stanford.EDU> <783@adobe.UUCP> <98@snll-arpagw.UUCP>
Sender: news@sun.soe.clarkson.edu
Reply-To: nelson@clutx.clarkson.edu
Organization: Clarkson University, Postdam NY
Lines: 42
In-reply-to: paolucci@snll-arpagw.UUCP's message of 26 Apr 89 01:37:58 GMT