From: randall@riffraff.slc.mentorg.com (Randall S. Krebs)
Subject: PHind INCludes until TERmination
Reply-To: randall_krebs@mentorg.com
Organization: Mentor Graphics Corp.,  Murray, Utah
Date: Fri, 24 Jul 1992 20:05:41 GMT

Every time I take perl to a new platform, I struggle to find the "right"
header files from /usr/include/... to install under /usr/local/lib/perl/...

Sure, "h2ph *.h sys/*.h" takes care of 99% of them, but I'm anal-retentive.
(Ergo, the program name?!)  I just can't sleep at night knowing that one
of those damn .ph files may depend on a file that hasn't been converted
yet.  Anyway, maybe Larry would consider adding something like this to
the installperl script (like maybe you didn't have enough to do?).

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  phincter
# Wrapped by randall@riffraff on Fri Jul 24 13:39:53 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'phincter' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'phincter'\"
else
echo shar: Extracting \"'phincter'\" \(1613 characters\)
sed "s/^X//" >'phincter' <<'END_OF_FILE'
X#!/usr/bin/perl
X#
X# phincter - PHind INCludes until TERmination
X#
X# This program should be run from /usr/include (or your standard include
X# file directory if deviant).  It takes a list of header file names on the
X# command line and produces the same list of file names plus any included
X# header file names on the standard output.
X#
X# Phincter is intended to be used during perl installation as follows:
X#
X#   # cd /usr/include
X#   # h2ph `phincter *.h sys/*.h`
X#
X# This will convert all standard header files in /usr/include and
X# /usr/include/sys PLUS any standard header files that they include.
X# That way, you are less likely to have missing .ph files months down
X# the road when you really need them.
X
X# record that we've already seen the files on the argument list
X@known{@ARGV} = (1) x @ARGV;
X
Xwhile ($file = shift(@ARGV)) {
X    # skip file if it doesn't exist
X    $file =~ /\.h$/ || next;
X    open(IN,"$file") || ((warn "Can't open $file: $!\n"),next);
X
X    # output this file name
X    print "$file\n";
X
X    # look thru the file for #include's
X    while (<IN>) {
X	chop;
X	while (/\\$/) {
X	    chop;
X	    $_ .= <IN>;
X	    chop;
X	}
X	# ignore comments
X	if (s:/\*:\200:g) {
X	    s:\*/:\201:g;
X	    s/\200[^\201]*\201//g;	# delete single line comments
X	    if (s/\200.*//) {		# begin multi-line comment?
X		$_ .= '/*';
X		$_ .= <IN>;
X		redo;
X	    }
X	}
X	# handle the #include'd file
X	if (s/^#\s*//) {
X	    if (/^include\s+<(.*)>/) {
X		$f = $1;
X		if (!defined($known{$f})) {
X		    # first encounter!  add to the list of arguments
X		    push(@ARGV, $f);
X		    $known{$f} = 1;
X		}
X	    }
X	}
X    }
X    close(IN);
X}
X
END_OF_FILE
if test 1613 -ne `wc -c <'phincter'`; then
    echo shar: \"'phincter'\" unpacked with wrong size!
fi
chmod +x 'phincter'
# end of 'phincter'
fi
echo shar: End of shell archive.
exit 0

-- 
   Randall S. Krebs             | A chicken is the egg's way of making more
   (randall_krebs@mentorg.com)  | eggs.  Government is anarchy's way of making
   Mentor Graphics Corp.        | more anarchy.
   Murray, Utah	                |              - Simon Moon -
Disclaimer:  Mentor Graphics pays me for what I do, not for what I say.