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: Re: argv ==> stdin (fast) Message-ID: <3027@rsch.WISC.EDU> Date: Wed, 3-Dec-86 21:22:56 EST Article-I.D.: rsch.3027 Posted: Wed Dec 3 21:22:56 1986 Date-Received: Wed, 3-Dec-86 23:36:36 EST References: <2972@rsch.WISC.EDU> <347@apple.UUCP> Reply-To: mcvoy@rsch.WISC.EDU (Lawrence W. McVoy) Organization: U of Wisconsin CS Dept Lines: 41 Keywords: make the commandline look like a file? Summary: Please read the original posting AGAIN Xref: mnetor comp.unix.questions:234 comp.unix.wizards:231 comp.lang.c:228 In article <347@apple.UUCP> mikes@apple.UUCP (Mike Shannon) writes: >To people using yacc & lex and trying to read from a file, not stdin, >you should note that in the code generated by lex for reading a character, >a call is made to getc(yyin). > yyin is simply a variable statically initialized to be stdin, but >you can *easily* re-assign it via a call to fopen(), as in > yyin = fopen(argv[1]) > or some such. I've seen one too many of these float by to take it any more. Please read what I asked in the first place and answer that. Your answers imply that I'm an idiot. While that is sometimes true, it's not the case here: From the original posting: Subject: Re: argv ==> stdin (fast) Keywords: make the commandline look like a file? ^^^^^^^^^^^ I am _NOT_ asking how to use fopen. Jeez. I'm asking how to make the characters typed on the command line look like they are in a file. From the point of view of lex/yacc. For example if I said % a.out 1+2/3 I want lex to see '1', '+', '2', '/', '3' EOF By the way, I have a zillion solutions, and thanks go out to all who replied. The best one said "get a pipe, stuff argv into it, close stdin, dup the read side of the pipe". Sorry, I can't remember who sent it, but thanks anyways... > Look at the code generated by these tools! It's easy to change it! >-- > Michael Shannon {apple!mikes} Look at the posting generated by these fingers! It's easy to read! -- Larry McVoy mcvoy@rsch.wisc.edu, {seismo, topaz, harvard, ihnp4, etc}!uwvax!mcvoy "They're coming soon! Quad-stated guru-gates!"