argv ==> stdin (fast)
    Lawrence W. McVoy 
    mcvoy at rsch.WISC.EDU
       
    Thu Nov 20 11:52:14 AEST 1986
    
    
  
Hi there.  I'm using lex & yacc to do some work for me and I can't 
quite get it.   The scanner & parser part works, but only if it's 
getting input from stdin.  I diddled lex.yy.c to change the getc(yyin)
call in the input() define to call my routine which feed sit characters 
from argv.  This works if I call yylex() from main, but if yyparse calls 
it then I get a "syntax error".  The same program works if I don't
diddle the input() routine.  And I can't figure out what's wrong
with my diddling.....
So, I'm stuck.  Does anyone have a cute way to feed a short byte stream
to stdin backwards?  Or a better solution?  I'm not willing to do 
anything as kludgey as
	#!/bin/sh
	cat << EOF | my_problem_program
	$*
	EOF
But that is _exactly_ what I want to do, only faster (no sh start up).
I suppose I could do the fork() and feed the child the command line as 
stdin, but even that is sort of yucko.
All suggestions welcome, and apologies to unix-wizards, but I figure you
don't read unix-questions anymore :-(
-- 
Larry McVoy 	        mcvoy at rsch.wisc.edu, 
      		        {seismo, topaz, harvard, ihnp4, etc}!uwvax!mcvoy
"They're coming soon!  Quad-stated guru-gates!"
    
    
More information about the Comp.unix.wizards
mailing list