Diffstat (limited to 'mcon/U/fieldn.U')
1 files changed, 82 insertions, 0 deletions
diff --git a/mcon/U/fieldn.U b/mcon/U/fieldn.U
new file mode 100644
@@ -0,0 +1,82 @@
+?RCS: $Id: fieldn.U 167 2013-05-08 17:58:00Z rmanfredi $
+?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
+?RCS: You may redistribute only under the terms of the Artistic License,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic License; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS: $Log: Findhdr.U,v $
+?RCS: Revision 22.214.171.124 1994/10/29 15:53:08 ram
+?RCS: patch36: added ?F: line for metalint file checking
+?RCS: Revision 126.96.36.199 1994/05/06 14:03:56 ram
+?RCS: patch23: cppminus must be after other cppflags, not before
+?RCS: Revision 3.0 1993/08/18 12:04:54 ram
+?RCS: Baseline for dist 3.0 netwide release.
+?MAKE:fieldn cppfilter: grep test tr rm cat startsh \
+ cppstdin cppminus osname
+?MAKE: -pick add $@ %<
+?S: This variable is used internally by Configure. It contains the position
+?S: of the included file name in cpp output. That is to say, when cpp
+?S: pre-processes a #include <file> line, it replaces it by a # line which
+?S: contains the original position in the input file and the full name of
+?S: included file, between "quotes".
+?S: This variable is used internally by Configure. It either contains
+?S: nothing or a shell piping stage to translate path components into "/".
+?S: It is meant to be used as "... | $cppfilter $grep ..." i.e. without any
+?S: explicit "|" character following it.
+?T:pos testaccess cline
+: determine filename position in cpp output
+echo " "
+echo "Computing filename position in cpp output for #include directives..." >&4
+echo '#include <stdio.h>' > foo.c
+case "$osname" in
+?X: VOS: path component separator is >
+ cppfilter="tr '\\\\>' '/' |"
+$cat >fieldn <<EOF
+$cppstdin $cppminus <foo.c 2>/dev/null | \
+$grep '^[ ]*#.*stdio\.h' | \
+while read cline; do
+ set \$cline
+ while $test \$# -gt 0; do
+ if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
+ echo "\$pos"
+ exit 0
+ pos=\`expr \$pos + 1\`
+chmod +x fieldn
+$rm -f foo.c fieldn
+case $fieldn in
+echo "Your cpp writes the filename in the $pos field of the line."