freopen of actual stdin question

rcj at burl.UUCP rcj at burl.UUCP
Wed Oct 26 14:59:36 AEST 1983


I have a question on freopen -- I want to run a program (an assembler
that I am writing -- called 'emma') on N files, where one of those
'files' might be stdin.  A sample command line might be:

m4 light_bulb | emma -dp foo bar paddy -

indicating that the user wants to assemble files 'foo', 'bar', and 'paddy';
then take input from stdin (the output of the 'm4' on 'light_bulb').

What I want to know is --  if I use freopen to associate each filename
in turn with stdin, like this:

freopen(filename, "r", stdin);

then how do I, upon encountering the '-' at the end of the command line,
re-associate the stream stdin with the output of the 'm4' that is being
piped into emma?

Please reply via mail -- to cut down on traffic I will tell you now
that I am posting this in the early am of Oct. 26.  If you are replying
to me after Oct. 30, you are probably too late as I will have an
answer by Monday if it kills me.  :-)

Thanks very much for your time,
-- 

The MAD Programmer -- 919-228-3814 (Cornet 291)
alias: Curtis Jackson	...![ floyd clyde ihnp4 mhuxv ]!burl!rcj



More information about the Comp.unix.wizards mailing list