Perl soelim (was Re: software tools question)

Randal Schwartz merlyn at iwarp.intel.com
Wed Dec 13 04:27:24 AEST 1989


In article <128978 at sun.Eng.Sun.COM>, henry%angel (Henry McGilton -- Software Products) writes:
| This requirement occurs all the time.  If you have access
| to any UNIX system running the 4.x BSD (Berkeley) flavor of
| UNIX, you should find a program called `soelim'.  While
| soelim was originally written for another purpose, it turns
| out that it does just what you want, namely, to do the
| source'ing of included files before the troff preprocessors
| do their work.  Then you run the pipeline of commands in the form:
| 
| 	soelim sourcefiles . . . | pic | tbl | eqn | troff . . .
| 
| I don't know if soelim is available on System V at this
| point.  If you have access to a BSD system, grab the source
| from such a system.  soelim was written by Bill Joy in
| 1977, and, as far as I know, is not copyrighted.

Well, a simple soelim in Perl (of course) is:

#!/usr/bin/perl -p
next unless /^\.so\s+(.*)/;
if (open(SO,$1)) {
	$_ = join("",<SO>);
	close(SO);
} else {
	warn "Cannot open $1 at $ARGV (line $.): $!";
}


This only works one level deep (no nested .so's), and requires Perl
3.0, although the only 3-ism is the "warn".

Usage is like 'cat'... one or more files are concatenated, no files
means use stdin.

Just another Perl hacker,
-- 
/== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\
| on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III  |
| merlyn at iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn	         |
\== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/



More information about the Comp.unix.questions mailing list