Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 +2.11; site dcl-cs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!mcvax!ukc!icdoc!dcl-cs!stephen
From: stephen@dcl-cs.UUCP (Stephen J. Muir)
Newsgroups: net.sources
Subject: psystem(3) - example usage
Message-ID: <269@dcl-cs.UUCP>
Date: Tue, 25-Jun-85 04:59:43 EDT
Article-I.D.: dcl-cs.269
Posted: Tue Jun 25 04:59:43 1985
Date-Received: Fri, 28-Jun-85 00:17:45 EDT
Reply-To: stephen@dcl-cs.UUCP (Stephen J. Muir)
Organization: Department of Computing at Lancaster University.
Lines: 29
Xpath: icdoc ivax

I was asked for a program to demonstrate the use of the (recently posted)
"psystem(3)".  Here it is.
----------------------------------- cut here ----------------------------------
/* This is NOT an example of a well written program */

main ()
	{ int	input, output;
	  static char	buf [512];
		/* you should really check the return value */
	  psystem ("dd conv=ucase", &input, &output, 0, 0);
		/* pump input into the command */
	  write (input, "this is my input\n", 17);
		/* indicate end-of-file to command */
	  close (input);
		/* collect output - you should really use the return value */
	  read (output, buf, 512);
		/* tidy up */
	  close (output);
		/* collect our zombie */
	  wait (0);
	  printf ("The output was \"%s\".\n", buf);
	  exit (0);
	}
-- 
UUCP:	...!seismo!mcvax!ukc!icdoc!dcl-cs!stephen
DARPA:	stephen%lancs.comp@ucl-cs	| Post: University of Lancaster,
JANET:	stephen@uk.ac.lancs.comp	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4599		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR