#Newsgroups: comp.archives.admin,comp.sys.mac.misc
#Subject: Pretty-printer for mac.archive.umich.edu listings
#From: [email protected] (Jonathan Eunice)
#Date: 31 Jan 93 17:46:19 GMT
#Followup-To: comp.archives.admin
#Distribution: na
#Organization: University of Pittsburgh Computer Science
#
#
#The following is a perl script that beautifies the listings
#periodically published in comp.archvies of new files at
#mac.archive.umich.edu.  These listings are very helpful, but printed in
#an ugly and hard-to-use format, IMHO.  This program fixes all that.
#Requires perl (of course) and a wide screen or window (output is ~120
#cols).
#
#
#
#
#--------------- CUT HERE ------------------
#!/usr/local/bin/perl

# mac-listing
#
# Perl script to pretty-print mac.archive.umich.edu listings
# of Mac files.  Output is ~120 columns--REQUIRES wide screen
# or window to be of any use whatever.

# To use:  Save archive announcements to a file,
# say 'macfiles'.  Trim mail headers/trailers.  Then run
# 'mac-listing macfiles'.  Sample output follows:

# File                          Path                                Comment
# ---------------------------------------------------------------------------------------------------------------------
# epsfibmpctomac1.01.sit.hqx    /mac/graphics/graphicsutil/         Translators to convert between different types of
#                                                                   EPSF (encapsulated PostScript) files.  For use with
#                                                                   Apple File Exchange.
#
# macghostscript2.52.cpt.hqx    /mac/graphics/graphicsutil/         A port of the Free Software Foundation's
#                                                                   Ghostscript -- a general- purpose PostScript
#                                                                   interpreter.  Includes fonts.  Minimal interface.
#                                                                   Requires Color QuickDraw.
#
# randomdotstereograms2.4.sit.h /mac/graphics/graphicsutil/         Software to view Random Dot Autostereograms (RDAs),
#                            qx                                     images that contain three dimensional information
#                                                                   in a single image instead of a pair of images
#                                                                   typically refered to as a stereo pair.  Several
#                                                                   images provides, and can also generate the same
#                                                                   images as provided. Slow, slow, slow, slow, slow
#                                                                   (but there isn't much else out there). Includes
#                                                                   versions for Macs with and without math
#                                                                   coprocessors.
#
# dithercomparison.sit.hqx      /mac/hypercard/organization/        Demonstrate the difference in quality between
#                                                                   standard Color QuickDraw dithering and QuickTime's
#                                                                   "fast dithering." Requires QuickTime and HyperCard
#                                                                   2.0.
#
# garton.cpt.hqx                /mac/system.extensions/font/type1/  Size:  18, 24, 36, 48 A semi-script serif display
#                                                                   font with a full set of  characters, numbers,
#                                                                   punctuation, a few ligatures, and a helping of
#                                                                   upper- and lower-case swash characters. Nice.
#                                                                   Includes TrueType.



# This program is in the public domain.  Do with it what you will.
# Written by Jonathan Eunice ([email protected]), who finds it
# useful and hopes you will too.  If you don't, too bad!
# Author makes no warranties whatever.  Use at your own risk.



$= = 999999;    # infinite page length, only one output header
               # change to 60 or so for one header per page

# scan input files

$first = 1;
while (<>) {
       chop;
       if (m=^/=) {            # pathname -- starts new entry
               if (!$first) {
                       $arr{$pathname} = $comment;
               }
               $pathname = $_;
               $first = 0;
               undef($comment);
       }
       elsif (/^\s*$/) {       # blank line
               next;           # skip it
       }
       elsif (/^\s*\d+\s+\d+\/\d+\/\d+\s+[\w\d]+/) {   # Infoline
               next;           # skip it
       }
       else {                  # must be comments
               m/^\s*(\S.*)\s*$/;      # take only good stuff
               $comment = "$comment $1"; # append to comment
       }

}

# now sort and print

@keys = keys(%arr);
@keys = sort(@keys);
foreach $key (@keys) {
       $key =~ m=^(/.+/)([\w\.]+)\s*$=;        # find line components
       $path = $1;
       $filename = $2;
       $comment = $arr{$key};
       $comment =~ s/^\s*//;
       write;                          # print line components
}


# Sample input lines follow.
#
# /mac/game/board/lineup2.01.cpt.hqx
#   98     1/19/93    BinHex4.0,Compact1.33
#
#    Connect Four.  You can play two player, or you vs. the computer, or
#    the computer vs. itself. Various degrees of difficulty.  Includes
#    option for play on a network.
#
# /mac/misc/demo/rightontime1.5.cpt.hqx
#  112     1/19/93    BinHex4.0,Compact1.33
#
#    An application that provides To-Do List, Calendar, and Reminder
#    features.  Demo version is limited to five records.
#
# /mac/system.extensions/chooser/chucksdrivers1.00d.sit.hqx
#   63     1/19/93    BinHex4.0,StuffIt1.5.1
#
#    Printer drivers that work with Panasonic/Epson 9 and 24 pin
#    printers and compatibles for both text and graphics.



# Output formats.

format STDOUT_TOP =
File                          Path                                Comment
---------------------------------------------------------------------------------------------------------------------