Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!lll-winken!decwrl!orc!mipos3!omepd!merlyn From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Perl soelim (was Re: software tools question) Keywords: software tools question macro include text processing Message-ID: <5339@omepd.UUCP> Date: 12 Dec 89 17:27:24 GMT References: <694@dgis.dtic.dla.mil> <128978@sun.Eng.Sun.COM> Sender: news@omepd.UUCP Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Hillsboro, Oregon, USA Lines: 40 In-reply-to: henry%angel@Sun.COM (Henry McGilton -- Software Products) In article <128978@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("",); 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@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/