#!/bin/sh ## Author: Parv, parv UNDERSCORE AT yahoo DOT com ## Modified: Jan 30 2002 ## ## License: free to use as you please w/ proper credit given ## ## Name: prase-ports-index ## ## Purpose: To view information about ports based on ## ${PORTSDIR}/INDEX, independent of the current directory one may be ## in ## ## Usage: ## prase-ports-index /path/to/ports/INDEX ## prase-ports-index | $PAGER ## prase-ports-index > file ## ## Dead: This script is not maintained any more. My focus has been ## shifted to the Perl version ... ## ## http://www103.pair.com/parv/comp/src/perl/parse-index ## ## ## See also: FreeBSD::Ports - a Perl module available as FreeBSD port ## # Don't forget to specify _your_ default location of INDEX file, # $Index, if you don't want to specify on the command line every # time. # # Currently only one line comment is shown instead of the detailed # description -- a future upgrade, needless to say # set to wherever the ports index is located if no argument specified Index=${1:-/usr/ports/INDEX} # if $Index is not a readable file, exit if [ ! -r $Index -o ! -f $Index ] then echo "* $Index cannot be read. make sure it exists as a regular file." exit 1 fi # sort INDEX extries based on, case-insensitive, names sort -bf $Index | awk -F \| ' { # print # - $1: portname # - $4: one line description; surrounded by "#" # - $2: port skeleton directory # - $3: directory where port will be installed by default # print $1 "\n#\n# " $4 "\n#\n " $2 "\n " $3 for (f=5;f<=NF;f++) { # skip # - $5: file containing detailed description # - $7: category, e.g. shell, net, misc # - empty lines # if (f == 5 || f == 7 || $f ~ /^$/ ) continue # print # - $6: e-mail address (for the person/enity to contact about a port) # - $8,$9: dependencies; highlighted by "--" or "==" # - $10: url # if (f == 8) hilite = "--" else if (f == 9) hilite = "==" else hilite = "" # print hilite " " $f } print "\n" }'