home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!news.mentorg.com!caeco!riffraff!randall
- From: randall@riffraff.slc.mentorg.com (Randall S. Krebs)
- Subject: Re: aub problem finding sys/socket.ph
- Message-ID: <1992Sep10.210105.9330@caeco.mentorg.com>
- Sender: randall@riffraff (Randall S. Krebs)
- Reply-To: randall_krebs@mentorg.com
- Organization: Mentor Graphics Corp., Murray, Utah
- References: <5601@blue.cis.pitt.edu.UUCP> <1992Sep9.043504.7463@odin.corp.sgi.com> <5638@blue.cis.pitt.edu.UUCP> <1992Sep9.142703.12533@news.eng.convex.com>
- Date: Thu, 10 Sep 1992 21:01:05 GMT
- Lines: 102
-
- In article <1992Sep9.142703.12533@news.eng.convex.com>, Tom Christiansen <tchrist@convex.COM> writes:
- >
- > Building all the *.ph files is something of a black art. For
- > any given *.h file, you first have to build every include
- > file it itself includes, recursively.
-
- Which is why I wrote and am reposting the following:
-
- #! /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 Thu Sep 10 15:00:39 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 | "My ultimate nightmare? Oh, that's an
- (randall_krebs@mentorg.com) | easy one! The McLaughlin group as dinner
- Mentor Graphics Corp. | guests."
- Murray, Utah |
- Disclaimer: Mentor Graphics pays me for what I do, not for what I say.
-