Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2002 22:56:21 -0800
From:      "Jeff Shevlen" <jeff@dsl.ca>
To:        "Giorgos Keramidas" <keramida@freebsd.org>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: CVSup release info
Message-ID:  <047201c1aa24$6423d8e0$b300a8c0@wenk>
References:  <20020131031616.GA73680@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <sys/param.h>' ; 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 <sys/param.h>' ; echo __FreeBSD_version )
: #include <sys/param.h>
: __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...
:
: --
: Giorgos Keramidas . . . . . . . . .
keramida@{ceid.upatras.gr,freebsd.org}
: FreeBSD Documentation Project . . . http://www.freebsd.org/docproj/
: FreeBSD: The power to serve . . . . http://www.freebsd.org/
:



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?047201c1aa24$6423d8e0$b300a8c0>