Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 1995 08:11:16 -0600 (CST)
From:      Gary Clark II <gclarkii@neon.gbdata.com>
To:        freebsd-hackers@FreeBSD.org
Subject:   Info inserter
Message-ID:  <199501091411.IAA21246@neon.gbdata.com>

next in thread | raw e-mail | index | archive | help
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 (<DIRFILE>) {
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199501091411.IAA21246>