From owner-freebsd-hackers Mon Jan 9 05:44:36 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id FAA25265 for hackers-outgoing; Mon, 9 Jan 1995 05:44:36 -0800 Received: from neon.gbdata.com (Phoenix-GW.GBData.COM [199.3.234.240]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id FAA25257 for ; Mon, 9 Jan 1995 05:44:15 -0800 Received: (from gclarkii@localhost) by neon.gbdata.com (8.6.9/8.6.9) id IAA21246 for freebsd-hackers@freebsd.org; Mon, 9 Jan 1995 08:11:17 -0600 From: Gary Clark II Message-Id: <199501091411.IAA21246@neon.gbdata.com> Subject: Info inserter To: freebsd-hackers@FreeBSD.org Date: Mon, 9 Jan 1995 08:11:16 -0600 (CST) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 2594 Sender: hackers-owner@FreeBSD.org Precedence: bulk Hi, Here is my infoline inserter. It's fairly simple and not totaly robust, but it should handle %99 of the needs we have. At this point it does not copy the info files from the directory to the info directory. You must either use make or do it manualy. NOTE: Command line: infoline -c catagory -d "directory" -h "Help Line" -m MenuItem -f infofiles catagory = Area of info file you wish to place the entry Uses a cookie of % which is a comment directory = Where is the dir file is located Help Line = Explaination or description to the program MenuItem = Word or Phrase that a person uses in menu mode infofiles = name of the root infofile for that menu choice If I have to, I will write a manual page, but it's so simple... Gary # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # infoline # echo x - infoline sed 's/^X//' >infoline << 'END-of-infoline' X#!/usr/bin/perl X# Perl util to add a line to the info dir file X# X X Xif ($#ARGV < 7) { X&usage; Xexit; X} X X Xwhile (@ARGV) { X $XX = shift; X $args{x} = "notused"; X if ($XX =~ /^-x/) { X $XY = "used"; X } else { X $XY = shift; X } X X if ($XX =~ /^-(c|x|d|h|f|i)/) { X $argu = $1; X if (($XY =~ /^-\w/||/^-\d/)) { X die "Invalid command line switch\n"; X } X $XY =~ /^(.*)$/; X $args{$argu} = $1; X print "$argu = $args{$argu}\n"; X $argument .= $argu; X X } else { X die "Invaild command line\n"; X } X X} X X X&printinfo; X X Xsub usage { Xprint "\nusage:\n\ninfoline -c catagory -d \"directory\" -h \"helpline\" -f infofile -i MenuItem\n\n"; X} X X X X X Xsub printinfo { X X$tempfile = "\/tmp\/infoline.$$"; X X$filedir = $args{d}; X$cat = $args{c}; X$menuitem = $args{i}; X$infofile = $args{f}; X$explain = $args{h}; X X X$cookie = "%"; X Xopen (TMPFILE, ">$tempfile"); Xopen (DIRFILE, "<$filedir\/dir"); X Xwhile () { X X if ($cat) { X if (/^% $cat/) { X print (TMPFILE "$_"); X print (TMPFILE "\n"); X print (TMPFILE "* $menuitem: ($infofile). $explain\n"); X } else { X print (TMPFILE "$_"); X } X } else { X print (TMPFILE "$_"); X } X} X Xprint (TMPFILE "* $menuitem: ($infofile). $explain\n"); X Xclose TMPFILE; Xclose DIRFILE; Xsystem "cp $tempfile $filedir\/dir"; Xunlink ("/tmp/infoline.$$"); X X} X END-of-infoline exit