From owner-freebsd-questions Thu Jan 31 7:59:57 2002 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-10.mail.nl.demon.net [194.159.73.20]) by hub.freebsd.org (Postfix) with ESMTP id A5B7C37B416 for ; Thu, 31 Jan 2002 07:59:47 -0800 (PST) Received: from [212.238.194.207] (helo=tanya.raggedclown.net) by post.mail.nl.demon.net with esmtp (Exim 3.33 #1) id 16WJcj-0006cN-00 for freebsd-questions@freebsd.org; Thu, 31 Jan 2002 15:59:41 +0000 Received: by tanya.raggedclown.net (tanya.raggedclown.intra, from userid 500) id 2720144F6F; Thu, 31 Jan 2002 16:59:38 +0100 (CET) Date: Thu, 31 Jan 2002 16:59:38 +0100 From: Cliff Sarginson To: freebsd-questions@FreeBSD.ORG Subject: Re: CVSup release info Message-ID: <20020131155938.GA1512@raggedclown.net> References: <20020131031616.GA73680@hades.hell.gr> <047201c1aa24$6423d8e0$b300a8c0@wenk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <047201c1aa24$6423d8e0$b300a8c0@wenk> User-Agent: Mutt/1.3.24i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jan 30, 2002 at 10:56:21PM -0800, Jeff Shevlen wrote: > That's interesting. I had no idea shell scripts could interface with > C like so. I have one last question in regards to the script. I > looked at man cpp and I didn't see anything about "-E"; not to > mention the " -" after the E. What does all this do? I ran the > script without any modifiers to cpp and I got the same result as with > "-E -" ! > > : > : $ ( echo '#include ' ; echo __FreeBSD_version ) | > cpp -E - | tail -1 > : > : 500028 > : > : Ah but it is simple really. cpp(1) is a preprocessor. It doesn't > : care if input comes from standard input. The symbol > _FreeBSD_version > : is defined in /usr/src/sys/sys/param.h (which finally is copied by > : installworld to /usr/include/sys/param.h). The two 'echo' commands > : produce a minimal C 'testbed' like below: > : > : $ ( echo '#include ' ; echo __FreeBSD_version ) > : #include > : __FreeBSD_version > : > : This piped into cpp, will be preprocessed, and __FreeBSD_version > (the > : last line of the source) be substituted with it's value as defined > in > : /usr/include/sys/param.h. The final tail is fairly obvious now... > : > : -- Mmm, I hate to be a killjoy, couldn't you do this with grep ? Just a passing thought :) -- Regards Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message