summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authortnn <tnn>2008-05-24 04:29:06 +0000
committertnn <tnn>2008-05-24 04:29:06 +0000
commit6ad378f91a91845c92779b4dcfa2780dc39f96e3 (patch)
tree25543591d351f3f62a0fad952c107473f9c2afad /pkgtools
parent30eb857b178f34bf8a23ffa3829a7192bc9df609 (diff)
downloadpkgsrc-6ad378f91a91845c92779b4dcfa2780dc39f96e3.tar.gz
minor nits and comments
Diffstat (limited to 'pkgtools')
-rwxr-xr-xpkgtools/compat_headers/files/mkhdr.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/pkgtools/compat_headers/files/mkhdr.sh b/pkgtools/compat_headers/files/mkhdr.sh
index 07fc3351476..a432065c452 100755
--- a/pkgtools/compat_headers/files/mkhdr.sh
+++ b/pkgtools/compat_headers/files/mkhdr.sh
@@ -1,18 +1,21 @@
#! /bin/sh
#
-# $NetBSD: mkhdr.sh,v 1.1.1.1 2008/05/24 03:35:42 tnn Exp $
+# $NetBSD: mkhdr.sh,v 1.2 2008/05/24 04:29:06 tnn Exp $
#
[ "${CC}" = "" ] && CC="cc"
-CPP="${CC} -E -"
+CPP="${CC} -E"
# Prints the full absolute pathname to the file that is included by doing
# #include <file.h>.
real_header() {
- echo "#include <$1>" | $CPP - 2> /dev/null |\
- awk -F\" '/^\# 1 "\// {if(!done){print $2;done=1;}}'
+ echo "#include <$1>" | ${CPP} - 2> /dev/null |\
+ awk -F\" '/^\# 1 "\// {if (!done) {print $2; done=1; }}'
}
+# Find the real header path
real_hdr="`real_header $1`"
[ "${real_hdr}" = "" ] && real_hdr="stdio.h"
-${CPP} | sed -e "s,@real_header@,${real_hdr}," -e 's/^#.*//' -e 's/^@/#/' | grep -v '^$'
+# Preprocess the input header. Substitute the real header location and
+# remove empty lines afterwards.
+${CPP} - | sed -e "s,@real_header@,${real_hdr}," -e 's/^#.*//' -e 's/^@/#/' | grep -v '^$'