Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!mcvoy From: mcvoy@rsch.WISC.EDU (Lawrence W. McVoy) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: argv ==> stdin (fast) Message-ID: <2972@rsch.WISC.EDU> Date: Wed, 19-Nov-86 20:52:14 EST Article-I.D.: rsch.2972 Posted: Wed Nov 19 20:52:14 1986 Date-Received: Wed, 19-Nov-86 22:13:25 EST Organization: U of Wisconsin CS Dept Lines: 31 Keywords: make the commandline look like a file? Xref: mnetor comp.unix.questions:116 comp.unix.wizards:121 comp.lang.c:102 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@rsch.wisc.edu, {seismo, topaz, harvard, ihnp4, etc}!uwvax!mcvoy "They're coming soon! Quad-stated guru-gates!"