[comp.sources.misc] v02i031: hdscan - interactive directory maintenance utility, Part 2/2

trb@stag.UUCP ( Todd Burkey ) (01/31/88)

Comp.sources.misc: Volume 2, Issue 31
Submitted-By: Todd Burkey <trb@stag.UUCP>
Archive-Name: hdscan/Part2

[WARNING!!!  THIS IS SHAREWARE.  ++bsa]

Here is a little utility you might find interesting. The version included
in this release is my first stab at porting the program over to Unix from
the Atari ST world, so please excuse the strange layout of the code (lots
of things were cut and even more things added to accommodate a non-graphics
environment)...also, my first exposure to curses wasn't all that pleasant.

  -Todd Burkey
  ...ihnp4!meccts!stag!trb

  (compile with cc -O hdscan.c -o hdscan -lcurses -ltermlib)
  (or if sysV: cc -O hdscan.c -o hdscan -lcurses -DNOTBSD)

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-r--r--   1 allbery  System     35820 Jan 30 16:50 hdscan.doc
# -rw-rw-rw-   1 allbery  uucp        3149 Jan  4 00:36 hdscan.man
#
echo 'x - hdscan.doc'
if test -f hdscan.doc; then echo 'shar: not overwriting hdscan.doc'; else
sed 's/^X//' << '________This_Is_The_END________' > hdscan.doc
X
X                       HDSCAN Shareware Ver. 3.00
X                      (The Unix Hard Disk Utility)
X                               (c) 1987
X                            by Todd Burkey
X
X
XNote: This documentation must be included with HDSCAN Version 3.0 (UNIX
X      special version) if you wish to transmit the program to anyone by
X      email, tape, or any other means.
X      
X      Any modification of the program or this document is expressly forbidden.
X      HDSCAN is Shareware and copyrighted 1987 by Todd Burkey.
X
XDISCLAIMER: I spend all my money on computers that outdate themselves within a
X            year, so I really don't need a disclaimer...although with all the
X	    strange flavors of Unix out there occasionally doing unnatural
X	    things, I should say "LET THE USER BEWARE".  There. Safe.
X
X1.0 INTRO:
X
XHDSCAN was designed initially to satisfy a simple backup need. HDSCAN is first
Xand foremost a utility that lets you tag files throughout your hard disk and
Xthen copy (or erase) them in one pass. Because I got carried away, HDSCAN also
Xlets you hexdump any file on the hard disk, view any file (even binary files
Xif you like), rename a file, perform daily backups to floppies, select for
Xdisplay files matching a specific string (i.e. to just see all file names that
Xhave .doc in them), select just files in one directory, select all the files on
Xall directories of a hard disk to scroll through, and more that will make
Xsense when you try out the program.
X
XOther features support archiving files, compressing/uncompressing files,
Xinvoking external programs, and most importantly, sorting files.  You can sort
Xby date (access/modify/change), name, size, protections, inode number, group
Xid, and user id in ascending or descending order. For example, you can
Xselect all .c files (all directories), sort them by reverse date, then easily
Xtag all the new files for copying to floppies. Or maybe sort an entire drive
Xby name to help find duplicate files (this will make more sense if your drives
Xget as messy as mine do). The sort in HDSCAN is a recursive quicksort, so even
Xthousands of files will be sorted in a few seconds. I have even added a very
Xsimple (and fast) file compare routine to allow quick checks to see if files
Xare duplicates. And you will find even more features embedded in the program
Xas you start using it.
X
X
X1.1 BRIEF HISTORY:
X
XThis program has had a strange history. After working my way up from 8 bit
XPC's (OSI, Atari 400/800, and CP/M), through the various fads (Mac, IBM PC,
Xand an Amiga), to my current 'addiction' of an ATARI ST and a Symmetrics 375
X(BSD 4.2 Box), I was faced with an interesting dilemma. As my disk space got
Xlarger, it took more and more time to 1) perform selective backups of files, 
X2) quickly find files, 3) determine what files were duplicates, and 4) in
Xgeneral, just keep track of, and manipulate, all the files on my systems.
X
X1.1.1 Ancient, boring stuff
X
XEven on CP/M, a program called SWEEP was a boon back in the days when we
Xthought a 1 meg 8" diskette was a LOT of space. Basically, SWEEP would scan
Xyour current directory and, at the touch of a key, you could view, hexdump,
Xand tag files for subsequent copy and/or deletion. Later I got hooked on XTREE
Xon my PC. Although it was quite slow scanning the disk, XTREE was able to
Xperform SWEEP-like operations across an entire partition (multiple
Xdirectories).  The potential of a program like XTREE intrigued me so much
Xthat about a year after I got my ST, I gave up waiting for someone else to
Xwrite one and decided to brave GEMDOS and write my own. What I ended up with
Xwas a hard disk tool that had features of SWEEP, XTREE, and a bunch of new
Xcapabilities that I had always wanted (one of which was the ability to scan
X30 megs in 2 seconds...speed is always nice.)
X
X1.1.2 Why Unix
X
XHDSCAN turned out to be so useful on the ST that one day (after spending
Xhours 'browsing' through my somewhat cluttered directories on my Unix box)
XI decided to port it to Unix. What is included in this release is the first
Xattempt at such a port. Although the code ported quite easily, there were a
Xlot of changes necessary to support the Unix file structure, program invokes,
Xand basic lack of graphics. Some of the user-friendliness of the program was
Xlost during the port (personal opinion)...possibly due to the loss of speed
X(during scans, scrolling through files, and redraws of screens) and the key
Xremapping I was forced into. You will also probably see a lot of places in
Xmy code where I could have optimized better for speed...I only dabble in C
X(and Unix for that matter), since at work I program solely in Pascal on
XApollos. Feel free to critique the code (nothing you can say will be as
Xhumbling as a 10 page 'analysis' I received years ago on alternative disk copy
Xdata compression techniques from someone who turned out to be 13 years old.)
X
X1.1.3 What it works on
X
XCurrently, I have used HDSCAN on the Symmetrics and Sun workstations under
X4.2, the Apollo workstation under 4.2 and SysV, several SysVr2 boxes, and
Xa SysVr3 box. It works best on high speed screens and can be quite a memory
Xhog when scanning large drives. In scanning speed, it is on par with find
Xin terms of the single pass scan it does at the beginning (just beating
Xout find on the Sun). Be extremely careful copying files on the Apollo,
Xsince many AEGIS files have headers that do not copy correctly with simple
Xopens...and I refuse to stick stuff like the map and unmap calls in this code.
XWhat I added to hdscan (right before this release) is the ability to make copy
Xuser definable (i.e. you can use HDSCAN's internal copy or define an external
Xroutine to be used...like /bin/cp or /com/cpf). I hope this works out.
X
X
X2.0.0 USING HDSCAN:
X
X2.1.0 First things first: HDSCAN.KEY
X
XBefore you run HDSCAN for the first time, you should probably create a
Xfile called HDSCAN.KEY and place it in your home directory. HDSCAN.KEY is
Xa control file that defines system and user specific things for HDSCAN.
XThis includes 'things' like telling HDSCAN where your favorite editor is
Xlocated, or what 'mode' you want to start HDSCAN in, or even what commands
Xto 'attach' to the auto-invoke keys (keys 0-9 in this Unix version of HDSCAN).
XWhile HDSCAN will work fine without HDSCAN.KEY, proper setup of this file will
Xbe well worth the time it takes to learn its somewhat cryptic structure.
X
X2.1.1 HDSCAN.KEY Syntax
X
XThe format of HDSCAN.KEY is actually very simple.  Each line in the HDSCAN.KEY
Xfile acts as either a key definition (keys 0-9), a parameter assignment, or
Xa comment. If a line does not have an equal sign ('=') or colon (':') in the
Xsecond character position, it is taken as a comment line.
X
X2.1.1.1 HDSCAN.KEY Key Bindings
X
XIf the line begins with one number followed by an '=' sign, then the text that
Xfollows the equal sign will be taken as a command (or commands) to be executed
Xwhen you press the appropriate number key. These commands can consist of
Xpretty much anything you would normally type from a shell, including the
Xuse of pipes and redirection of input and output. Another important feature is
Xthat the commands can be parameterized by embedding @F, @P, @f, @p, ?, and < 
Xin the command line. This will make more sense once you start using the HDSCAN,
Xbut @F will expand into the full pathname of the file you are 'ON' when you
Xselect the command, @P will be the full file name without the extender (i.e.
Xif /usr/trb/test.c is the FULL pathname, then @P will expand to /usr/trb/test).
XLikewise, @f will give you the full file name (test.c) and @p will give just
Xthe prefix of the name (test). Finally, if the first character of the command
Xline is a ? the user will be prompted before the command is invoked, and if
Xit is a < then the user will be prompted to type in the full command.
X
X2.1.1.2 HDSCAN.KEY Parameters
X
XIf the line begins with a letter, dash ('-'), or plus ('+') followed by a ':',
Xthen the information following the ':' will be passed (kind of like parameters)
Xinto HDSCAN at startup.  I know, I could have used environment variables, but
Xthis was easier and simpler for people to set up. Currently, the 'parameters'
Xthat are supported are:
X
X  'G'     (ghost mode)
X  'X'     (eXpert flag)
X  'A'     (arc path)
X  'B'     (backup device)
X  'D'     (diff path)
X  'E'     (editor path)
X  'U'/'M' (unmount/mount info)
X  'u'/'c' (uncompress/compress path)
X  '+'     Always scan this directory path
X  '-'     Never traverse directories of this name
X
XOne other letter, 'C'(copy path), is available to define an external
Xprogram to do copies for you. Please only define external copy programs if the
Xinternal copy routine does not work (the internal one is faster and cleaner.)
X
X2.1.2 HDSCAN.KEY Example
X
XFor example, let's say you want to have HDSCAN always start up in GHOST mode,
Xwith the eXpert mode turned off, your favorite editor is /usr/local/jove, you
Xhave arc in your home directory, you want /floppy to be your backup device,
Xand you want to be able to perform a variety of commands on files at the
Xpress of the key. The following HDSCAN.KEY file would accomplish this.
X
X-------sample HDSCAN.KEY file--------
X+:/usr/trb/doc
X+:/usr/spool/uucp
X-:arcs
X-:usr2
XG:Y
XX:N
XE:/usr/local/jove
XA:/usr/trb/arc
XB:/floppy/
XU:umount /dev/fd0
XM:mount /dev/fd0 /floppy
X/* do a word count of the current file */
X1=wc @F
X/* compile the current file after prompting the user to do so */
X2=?cc -O @F -o @P
X/* do a less of the current file */
X3=less @F
X/* find out how much space is used on the backup device */
X4=df -i /dev/fd0
X/* drop into a shell...somewhat unnecessary on BSD systems */
X5=/bin/sh
X/* copy the current file into my catchall directory */
X6=cp @F /usr/trb/packrat
X/* Prompt the user before invoking sh on the current file */
X8=?/bin/sh @F
X/* nroff the current man page and pipe it into less */
X9=nroff -man @F | /usr/local/less
X/* dynamically prompt the user for the command to issue */
X0=<
X-----end of sample HDSCAN.KEY file--------
X
XNote that in this file, compress and uncompress were not redefined, so
XHDSCAN will assume that you actually have commands called compress and
Xuncompress somewhere in your normal search paths. Also, note that the
Xfile is really called HDSCAN.KEY, not hdscan.key...
X
X
X2.2.0 INVOKING THE PROGRAM:
X
XVery simple. Just move to the directory that you want to scan and type
X
X  hdscan         <--assuming, of course, that it is in your search path
X
XOr, you can type in the paths you want to scan as command line options.
XSee the man page for hdscan for more info on this feature.
X
X2.2.1 Curses:
X
XIf you are on a slow terminal (<=9600 baud), that is probably what you will
Xbe doing now. When I switched from using graphics on the ST to using the
XCURSES library on Unix, I really missed the ability to blit between screens
Xand have <1 second refreshes. In any case, don't despair, there is a special
Xmode for slow terminals (see Ghost Mode). But first, let's look at the display.
X
XYou should see a display composed of highlighted fields appear. If you
Xdon't see reverse fields then curses on your system has looked at your
Xtermcap/termlib entry and decided for some reason not to use them (i.e. if
Xyour terminal doesn't support it or if your termcap entry has set up bold
Xfor standout mode instead). You can think of this as either a blessing or a
Xcurse (no pun), either way you end up seeing the display. Reverse field on
Xany terminal slower than 9600 baud really makes an application seem slow, but
Xwithout the reverse fields, it takes the eyes longer to track down meaningful
Xinformation on the screen. You give up some speed for another either way you
Xgo. In any case, the screen will be somewhat confusing to the beginner, so
XI will explain here what you are looking at.
X
X2.2.2 The Main Display:
X
XRight after invoking HDSCAN, you will see a message near the center of the
XHDSCAN display that says "Traversing Your Directory Tree(s)". At the same
Xtime, you will see directory paths flipping up in the PATH: window at the
Xtop of the screen. This is just HDSCAN going out and gathering up all the
Xfile information it needs. The speed of the scan is very system dependent,
Xbut eventually the "Traversing..." message will go away and you will be all
Xset.
X
XMost noticeable on the screen will be a tall box near the right of the screen
Xfilled with file names. That is the 'selected file' window and you can scroll
Xup and down through all selected files with the h, j, k, and l keys (more on
Xthis later) to quickly get to a file. The file you are currently 'ON'
Xwill be highlighted (both reverse fielded and with a > sign next to it).
X
XAs you scroll through the file names, notice that the directory the file is
Xin, it's size, and it's dates (modify/access/change), are automatically
Xupdated in windows near the top left of the screen.
X
XNext to the file size window is a window that will make more sense later. It
Xdisplays the total size of all Tagged files. This proves useful when you are
Xmoving around the hard disk, deciding which files will fit on which floppies.
X
XBelow these two windows is a long window used for prompts. Look in this
Xwindow if you aren't sure why something isn't happening...it might be asking
Xyou a question.
X
XBelow the prompt window is a big free space which I am sure will eventually get
Xfilled up. Right now it contains some brief help (and displays extended file
Xinfo when HDSCAN is operated in eXpert mode.)
X
XBelow that is a status line that basically tells you 1) what you have selected
X(i.e. ALL will appear if all partitions are chosen, DIR will appear if you have
Xselected a single directory to work in, and a string of 1-8 characters will
Xappear if the selection was made using a wildcard string search), 2) the sort
Xorder (initially RANDOM to give you an idea of how fractured your file space
Xis), 3) the number of selected files, and 4) the total size in bytes of all
Xselected files.
X
X
X3.0 File Selection Mode: Commands
X
XYou can skip this section and just use it for reference if you are familiar
Xwith the ST version of HDSCAN. Everyone else would be wise to at least do
Xa quick scan of the commands.
X
X3.1 Moving About:
X
XOne important thing to learn before we get into the various commands is
Xthat to scroll through the files in the file window, you can use the h,
Xj, k, and l keys. The j/k keys will scroll down/up in the file window
Xrespectively. Likewise, the h/l keys will page up/down in the list. If
Xyou want to go all the way up or down in the list of files displayed in
Xthe window, then use the H and L keys. If you have really slow terminals
Xand still want to use HDSCAN for some reason, use the J/K keys instead of
Xthe j/k keys. This will cause scrolling without updating the current file
Xinfo on the screen.
X
X3.2 TAGGING STuff:
X
XTagged files are a fundamental feature of hdscan and its usage. To tag a file,
Xsimply scroll to the file you want and press the 't' key. You will see a '*'
Xappear in a little scrolling region next to the file name and the file window
Xwill scroll to the next file (so you can keep pressing 't' to select a bunch
Xof files.) As each file is Tagged, you will see the total Tagged size increase
Xin the TOTAL TAGGED window. To untag a file, just use the 'u' key. To untag
Xall files, type 'U'. Note that directories will also appear in the file
Xselection window (they have a 'D' next to them). I don't allow tagging of
Xdirectories so you can't delete them, but they are useful for reference to
Xsee what all is in a directory (and when you are checking out protections,
Xmodify dates, etc).
X
X3.3 SEARCHING AND SELECTING STuff:
X
X3.3.1 Searching for files
X
XMost of the time, you will probably just want to search out a few files for
Xtagging and won't want to scroll over all 5000 or so files on the hard disk. To
Xsave some time, if you press the 's' key, you will be prompted for a <9
Xcharacter string to search for (you can enter stuff like .doc, .c, junk, etc
Xbut no * or ? wildcards are supported...to be truthful, I never even had any
Xrequests for wildcards.) The 's' key option will make its selection from all
Xavailable files. If you just want to perform a selection from the currently
Xselected subset of files, the 'S' key should be used instead. This will
Xallow you to easily narrow in on a set of file names. Both options will
Xallow you to enter just an asterisk (*) if you want to just see Tagged files,
Xand entering only a carriage return will reselect everything.
X
X3.3.2 Selecting/Searching for a directory
X
XThere are also times when you might only want to select the files in one
Xdirectory. To do so, pressing the TAB key will turn the PATH: window into a
Xlittle scrolling region, allowing you to use the j & k keys to quickly scroll
Xto the appropriate directory. If you have a lot of directories to scroll past,
Xyou can just type '/' or '\' followed by a few characters that are in the
Xdirectory name to search forwards or backwards respectively in the directory
Xtree. When you have the directory you want in the PATH: window, you can either
Xpress the TAB key again (to select all the files in the currently selected
Xdirectory) or the 'A' key (to select files in all directories below and
Xincluding the currently selected directory.) If there are no files in the
Xdirectory you are trying to select, then HDSCAN will inform you so and let
Xyou select another directory.
X
XThere is also another method that allows directory selection. If you press
Xthe N or P keys, the directory in the tree that is Next/Previous to the
Xone in the PATH: window will be selected. If you have a fast terminal, this
Xis a useful way of swinging through directories. Note that in both selection
Xmethods, my definition of the next directory in a tree is based on the next
Xalphabetically sorted path for that directory. This will be more apparent
Xonce you use the program.
X
X3.3.3 Regenerating the file list
X
XEvery once in awhile, you may want to regenerate the list of files (i.e. you
Xhave been doing some heavy deletes and don't care to see the 'X'ed out deleted
Xfiles on the file list any more). To do so, just press the ! key. Note that
Xthis command is useful if you have been performing commands that have modified
Xyour directory structure via 'outside' programs as well (more on that later).
XAlso, note that this command automatically reselects everything.
X
X3.4 DANGEROUS STuff (Copy/Erase all Tagged files...and more):
X
XOnce you have everything that you need Tagged, pressing the 'm' key will
Xinvoke the mass copy routine. This will prompt you for the destination path
Xand allow you to copy all Tagged files (with or without an interactive query
Xon each file). Once copied, the '*' next to a file name will become a '#' to
Xshow that the copy was successful. If you later want to re-tag the '#' files,
Xpossibly for mass erase ('E' key), you can do so by pressing the 'T' key.
XNote: to erase just one file, place the scroll bar over the file and press
Xthe D key.
X
XOne nice feature if you have a removable backup device that is mountable as
Xa file system (i.e. a floppy) is that you can specify the backup device, it's
Xmount, and it's unmount commands in the HDSCAN.KEY configuration file and
XHDSCAN will be smart to mount the device, copy as many files as it can to the
Xdevice, unmount the device when it gets an error (i.e. file system full), and
Xthen prompt the user for a media change before continuing. The worst that
Xwill happen is that you may get a messy looking screen if your system insists
Xon putting 'file system full' on the console device every time your floppy
X(or whatever) gets full.
X
X3.5 VISUAL STuff (Viewing and Dumping files):
X
XOne nice feature of HDSCAN is that by pressing the 'v' key, you can view the
Xfile that you are currently 'ON' in the file window. The view option does
Xa character by character analysis of the file, just displaying the ASCII
Xprintable characters on the screen, so it can be used for looking for strings
Xin a binary file. Note that because I chose to allow looking at binary files,
XI also turned off highlighting, tabbing, and formfeeds that sometimes appear
Xin files. If you want to get a HEX dump, press the 'V' key and you will get
Xa page by page listing of your file in both HEX and ASCII. You can edit
Xthe file you are currently pointing at in the scroll window by pressing the
X'*' key (shift 8). 'vi', or whatever you designated as your favorite editor
Xin the HDSCAN.KEY file, will be loaded, read in the file, allow you to edit
Xand save the file, and then return you to HDSCAN when you are done.
X
X3.6 ARC STuff:    /* untested on Unix. I don't have arc yet */
X
XTo get a verbose listing of the contents of an ARC file, move to the file you
Xwant to look at and then press the = key. While the verbose listing is being
Xdisplayed, you can press the CTRL-S key to pause the listing and the CTRL-Q
Xkey to continue the listing.
X
XTo add all Tagged files to an ARC file, just move the scroll bar over the ARC
Xfile you want to add the Tagged stuff to and hit the + key. You will be asked
Xfor a path name (in case you want to add to an ARC file that doesn't exist)
Xand you can either hit return (to select the file you were scrolling over, or
Xtype in the full pathname of the file you want to create or add to (i.e.
X/usr/trb/pict1.arc is a full pathname). The Tagged files will then be ARC'ed
Xtogether. Please note that the current implementation of 'add to ARC' is
Xhorribly inefficient...but it works.
X
X3.7 SOMEWHAT NEAT STuff:
X
X3.7.1 Sorting files
X
XHDSCAN allows you to sort all selected files (don't confuse Tagged with
Xselected...selected files are simply everything you can currently scroll past
Xin the file name window, whereas Tagged files are those you have Tagged with
Xthe T key for some future purpose.) By pressing the 'o' key, you will tell
XHDSCAN that you wish to sort the selected files. HDSCAN will prompt you for
Xthe sort key (i.e. file size, name, date, protections, etc) and then ask
Xwhether you want to see them in ascending or descending order). Since you can
Xsort files over a whole file system, a sort by descending date is a useful way
Xto tag what has changed since your last backup. A sort by ascending name is
Xuseful to find all those duplicate files. One note on sorting: I always fall
Xback to RANDOM order upon a new selection by either search (S) or directory
Xselect (TAB). This provides the fastest response assuming you aren't always
Xwanting to see the stuff sorted. If you really want files to be maintained in
Xa particular order for viewing purposes, use the 'O' key to initiate your
Xsort option. This will tell HDSCAN to maintain that sort order throughout all
Xsubsequent file reselects...until another sort option is selected.
X
X3.7.2 Comparing files
X
XAnother important feature in HDSCAN is the ability to quickly compare files.
XYou can use either the 'c' key or the 'C' key to perform this function. The
X'c' key will use an internal routine to quickly ascertain that the files are
Xthe same or not, while the 'C' key will use the Unix diff command to perform
Xa more extensive compare (or whatever command you have used in the HDSCAN.KEY
X'D:' override option. To perform a compare, move the cursor to one of the files
Xyou want to compare and press the 'c' or 'C' key.  When you do so, a C will
Xappear next to the file name and you will be prompted to go find another file
Xto compare it against. When you have the scroll bar over the other file, press
Xc or C again and the two files will be compared. For sanity's sake, my routine
Xjust shows the first 15 differences (byte locations and values) that the program
Xfinds. Note that you can do any number of file searches and directory matches
Xin between selecting the first and second compare files.
X
X3.8 POWERFUL STuff:
X
X3.8.1 Doing things to a file
X
XBecause I got tired adding features to the program and it was getting big, I
Xdecided to add one more feature. This is probably the most powerful feature
X(and the most confusing) as well. I decided to make the 0 to 9 keys into
Xuser definable keys. I have mentioned already how to create the HDSCAN.KEY
Xfile, so will only mention here that to use the program you have assigned to
Xthe key, just press the appropriate key. If you forget what the user defined
Xkey assignments are, just press the 'I' key and you will be given a listing of
Xthe keys (along with a summary of disk space). This programmable key option
Xuses the system() call, so you can even invoke commands that do redirection.
X
X3.8.2 Doing things to all Tagged files
X
XGuess what you can also do with Tagged files? If you press the 'M' key after
Xtagging a bunch of files, you will be prompted to press a command key (0-9).
XYep, you guessed it. You can invoke any command upon all of the files that
Xyou have Tagged, one at a time. You can optionally have HDSCAN pause after
Xeach file is 'processed' in this fashion or just let it run through all the
Xfiles.
X
X3.9 FINAL STuff:
X
XNow, what have I missed? There are quite a few little options that I rarely
Xuse, but that people requested for some reason or other on the ST.
X
X3.9.1 Renaming files
X
XTo rename a file, just hit the 'R' key and type in the new name. The file name
Xyou are currently selecting in the file window will be renamed.
X
X3.9.2 Creating directories
X
XTo create a directory, just press the ~ key. You will be prompted for a
Xdirectory name. You can type in the complete path of the directory you want
Xcreated (i.e.  /usr/trb/PICTURES) or if you are already inside the directory
Xyou want to create the new dir in, just prefix the name of the new directory
Xwith a ~ character (i.e. if you see /usr/trb up in the PATH window, just type:
X   ~PICTURES
Xto achieve the same thing as typing /usr/trb/PICTURES). This was originally
Xintended for creating directories on the output media, so creating a directory
Xwill not cause that directory to be visible in the file selector window unless
Xyou do a rescan ('!' key).
X
X3.9.3 Cleaning up the directory order
X
XTo beautify ('B' key) the order that files are presented, I added an option
Xthat goes through and groups all files into disk order, rather than the RANDOM
Xorder that you will see files in upon running HDSCAN. The RANDOM order is
Xactually the same tree order the files appear in your tables, so they are
Xalready clustered together within their respective subdirectories. It is just
Xthat as your hard disk gets more fractured due to erasing and moving files
Xaround, your tables will get messier and messier. After you get used to
Xviewing files via using the match, directory select, and sort options, you
Xwill probably never even bother using the 'B' key.
X
X3.9.4 Ghost Mode Toggle
X
XThe 'G' key can be used to toggle between the normal display mode and what
XI call Ghost mode. The normal display has a fair amount of reverse field'ed
Xareas to box in and emphasize the informatation fields. On some terminals,
Xhowever, this reverse field process is quite slow, so you can turn it off by
Xpressing the 'G' key. Note that it can also be turned off by invoking hdscan
Xwith a -g in the command line or with a line G:N in the HDSCAN.KEY file.
X
X3.9.5 eXpert Mode Toggle
X
XThe 'X' key will toggle between showing some brief help in the lower left
Xcorner of the screen to showing extended information about files. This
Xextended information consists of the file protections, user id, group id,
Xnumber of links, and inode number. The information is updated dynamically
Xas you scroll the files by in the file window.
X
X3.9.6 WARNING!
X
XSome words of caution before you continue. First, while copying,
XHDSCAN does not check to see if the destination file already exists...it will
Xjust overwrite the destination file. Second, I don't do any bounds checking on
Xinput, so if you feel you must have long directory names that require you to
Xtype in over the scroll window graphics, go ahead. You can't hurt anything
Xthat pressing the ? key twice won't solve. I know that I should really go
Xin and prevent that from happening, but this program was designed not to be
Xrestrictive and should allow you to use it in ways I haven't planned for yet
X(planning for the unplanned?)  Finally, be careful about using the 'e' key.
XIf you tag some files in one directory, then do a search for some other files
Xand tag some of them, be aware that the previously Tagged files will also get
Xerased (unless you un-tagged them of course). Just because you can't see the
Xfile any more in your currently selected subset of the disk does not mean it
Xisn't Tagged (that will be obvious, actually, if you look at the total Tagged
Xwindow). If you are at all unsure, just use the select option to select all
XTagged files prior to deleting them ('s' and then search for '*'). Happy
Xcomputing...
X
X
X4.0 SUMMARY OF COMMANDS:
X
XSure, now that I have told you about all the commands I condense everything
Xinto one paragraph:
X
X(~) key:   Create a directory  
X! key:     Rescan all directories or just the directory in the PATH: window
X# key:     Invoke selected program (i.e. the file under the cursor)
X+ key:     Add Tagged files to an existing .arc file (or create a new one)
X0-9 keys:  Run external programs (defined in HDSCAN.KEY)
X= key:     Verbose Arc listing (peek at the names/sizes of ARC files)
X?/I keys:  HELP (basically this info)/keymap info (i.e. command key bindings) 
XTAB key:   Select files by directory (or by subtree)
Xc/C keys:  Compare/Diff two files. The diff option is user programmable.
Xd key:     Delete current file (verification will be requested.)
Xe key:     Erase all Tagged files (verification will be requested.)
XG/X keys:  Ghost (minimal reverse fields)/eXpert (more file info) mode toggle
Xh/l keys:  Page up/down in the file selection window
XH/L keys:  Go to the Top/Bottom of the selected list of files 
Xk/j keys:  Scroll up/down in the file selection window
Xm/M keys:  Mass copy/process(i.e. run external programs on) all tagged files. 
XN/P keys:  Move to the next/previous directory and select all files in it
Xo/O keys:  Order (sort) the selected files (o=just for now, O=Always)
XR key:     Change name of file
Xs/S keys:  Select match on all/Subset
Xt key:     Tag a file 
XT key:     Retag all Copied files   
Xu key:     Untag a file 
XU key:     Untag all Tagged files    
Xv key:     View a file/strings-like 
XV key:     View a file in HEX/ASCII  
XZ/z keys:  Compress/Uncompress file 
X
X
X5.0 Currently known bugs/limitations:
X
X1) Not overly certain that my use of curses was optimal for display updates.
X2) HDSCAN is a memory hog if you scan entire partitions (10,000+ files).
X3) one other limitation is that if you have more than FILEMAX files in your
X   directory path, HDSCAN will tell you so and stop. I know, it could just stop
X   and let you look at what it found up to that point, but I decided to abort
X   instead.
X4) Remember that you can always use ctl-X or whatever you have kill assigned
X   to to abort out of HDSCAN. I only play games with the interrupt (CTL-C) key.
X   Or you can always CTL-Z when on a BSD system...
X
X6.0 Version 3.0: The UNIX Port
X
XThis section is for those ST owners out there who already know all about
Xthe ST version of HDSCAN and thought they could skip over the docs this
Xtime around. Sorry, it just isn't that easy. You may not even recognize the
Xthing any more. I do have to say that I am surprised at how easy things ported
X(after some heavy cursing at curses...); and switching from a fast FAT table
Xscan to a slow READDIR/STAT environment didn't prove unbearable. I had to
Xlearn a lot about the Unix file system, but I think everything is stable now.
X
XFor those of you familiar with the old ST version of HDSCAN, the following
Xfeatures are new for Unix:
X
X  1) More dates. Since Unix files have 3, that's what you see now on the
X     HDSCAN screen (Modify/Access/Change Dates).
X  2) An eXpert mode that you can see by pressing the 'X' key. Basically,
X     this mode just clears the little help display in the lower left corner
X     of the screen and shows you the current files' inode number, protections,
X     number of links, user id, and group id.
X  3) More extensive sorts. You can sort by modify/access/creation dates as
X     well as the inode number, protections, user id, and group id. The latter
X     expert mode sorts prove useful for system administrators...
X  4) Reconfigured keys to allow users that don't have terminals with function
X     keys and arrows to use HDSCAN. I was going to make the keys reconfigurable
X     but it seems clean enough the way I have it now. Instead of function keys,
X     the 0-9 keys are used. Instead of arrow keys, the h,j,k, and l keys are
X     used (ala vi). Press the '?' key while in HDSCAN to get more info on these
X     keys.
X  5) Restructured the display screen (big difference displaying 32 character
X     filenames as opposed to the ST/PCDOS 12 characters.)
X  6) Curses, curses, curses. At first, I thought using curses was kind of neat,
X     but I quickly learned better. On the ST, I used graphics and simple vt52
X     calls for cursor movement. Everything was cut and dried. Under Unix,
X     curses seems to work slightly different on every system I try it on. I
X     ended up making everything very, very simple and I hope there aren't any
X     surprises. Just in case, I put together a ghost mode option ('G' key)
X     that reduces the amount of 'highlighting' of text that is performed by
X     the program. This also reduced the amount of text that needed to be
X     transferred if you are using slow terminals (9600 baud or less).
X  7) Would you believe Mass command key invokes? If you tag a bunch of files,
X     then press the M key you will be prompted for a command key (0-9). Yep,
X     you can now perform a user-definable command operation on all the tagged
X     files. I have come up with a lot of strange uses for this option.
X  8) Mount/dismount support for things like floppies during copying.
X  9) Compress/Uncompress of a file at the press of a key ('Z'/'z' keys).
X 10) Parameterized macros attached to the 0-9 keys...
X 11) Limited interrupt capacity. I allow you to ctl-C most operations without
X     blowing away the program. You can still ctl-Z and kill the program if
X     you really need to.
X 12) Enhanced directory features. This includes searching while in the
X     directory selection mode and the ability to cycle through the directories
X     one at a time with the N and P keys while in file selection mode.
X
X7.0 FINALLY, THE END IS NEAR:
X  
XAgain, have fun with the program. It is meant to be a utility that is used
Xfrom time to time. It was never intended to be used as a shell as so many
Xpeople seem to like to use similar tools on the PC for. Someday, maybe, but
Xit has a long way to go first. I should also remind everyone again that this
Xis NOT a public domain program. I am distributing it Shareware. What this
Xmeans is that you can use the program to your heart's content, modify it as
Xmuch as you want for your own PERSONAL use, but when you pass it on to other
Xpeople (friends, enemies, whatever), it must be passed on in it's original,
Xunmodified state. This applies to source code, derived binary files, and
Xdocumentation. If there really is a change you feel that the world must
Xhave, send it to me and I will try to integrate it into a future version.
XOf course, Shareware also means that if you like the program, really use it,
Xand want to help fund further development, please don't be shy. I am asking
Xfor a Shareware contribution of $20, which was all that the production ST
Xversion was going for (sans source code.) If you can't afford that, even a
Xletter is appreciated if you find the program useful (or if it would be useful
Xif it had a certain feature, for that matter). And yes, Corporate Licensing is
Xavailable as well.
X
X       Todd Burkey
X       3546 Pilgrim Ln
X       Plymouth, MN 55441
X       
X	 trb@stag.UUCP
X       or ..ihnp4!meccts!stag!trb
X
X5/15/1987  -  HDSCAN ver 1.3 (Shareware) and 2.3 (professional)
X12/25/1987 -  HDSCAN ver 3.0 (Shareware)
________This_Is_The_END________
if test `wc -l < hdscan.doc` -ne 672; then
	echo 'shar: hdscan.doc was damaged during transit (should have been 672 bytes)'
fi
fi		; : end of overwriting check
echo 'x - hdscan.man'
if test -f hdscan.man; then echo 'shar: not overwriting hdscan.man'; else
sed 's/^X//' << '________This_Is_The_END________' > hdscan.man
X.TH HDSCAN 1 3.00 (12/25/87)
X.SH NAME
X\fBhdscan\fR \- scans your directories and allows interactive perusal and file maintanence.
X.SH USAGE
X.br
X.B hdscan
X[
X.B \-g
X.B \-x
X.B \-b
X.B \-0
X[
X.B \-i
X.I inam
X]
X.B 
X.I path ...
X]
X.SH DESCRIPTION
X.B Hdscan
Xis an advanced directory browser with features that allow easy
Xfile maintanence, incremental backups, file comparison, and more.
X.B Hdscan
Xwill quickly traverse your directory (or multiple directories) and
Xpresent you with a single key interface to the file system.
X.SH OPTIONS
XAt its' simplest,
X.B hdscan
Xcan be run without any command line options.
XIf you do so,
X.B hdscan
Xwill traverse every directory below the one you
Xare currently in (plus any directories specified in the
X.I HDSCAN.KEY
Xfile which is discussed in the FILES section.) To provide more specific
Xuser control, the following command line options were added.
X.TP
X.B -g
XThis tells
X.B hdscan
Xto start up with Ghost mode enabled. This mode uses less reverse
Xfields (for highliting) and works better on slow terminals.
X.TP
X.B -x
XThis tells
X.B hdscan
Xto start up with eXpert mode enabled. This mode hides the help info
Xon the main screen and replaces it with extended info about the files
X(i.e. protections, uid, gid, etc).
X.TP
X.B -b
XThis option tells
X.B hdscan
Xto perform a little sorting and organizing of the file display upon start up.
XBasically, after scanning the directories,
X.B hdscan
Xwill sort all the files by name and then further sort everything by directory.
XThis saves you a few steps when you invoke
X.B hdscan.
XNote that this may not be practical on slow CPU's if you plan on scanning LOTS
Xof files.
X.TP
X.B -0
XThis tells
X.B hdscan
Xto not descend down directory trees during the scanning
Xprocess.
X.TP
X\fB\-i\fR \fIinam\fR
X.B Hdscan
Xwill never traverse directories that have the name
X.I inam.
XThis is a good way of speeding up the scanning process if you know
Xof specific directories that you never want to traverse (this will
Xbecome more apparent once you scan your directories a time or two).
X.TP
X\fIpath ...\fR
XYou can provide a list of paths for
X.B hdscan
Xto scan (otherwise it will scan your current directory.)
X.SH CAUTIONS
X.B Hdscan
Xtakes up a lot of memory, so it shouldn't be used when commands like
X.B find
Xwould suffice. Also, remember that
X.B hdscan
Xis a curses application, so it does require a terminal with screen
Xaddressing capability.
X.SH FILES
X.TP 2i
X.I HDSCAN.KEY
X.B Hdscan
Xautomatically will read in a variety of user definable options from
Xthe
X.I HDSCAN.KEY
Xfile. A local copy of
X.I HDSCAN.KEY
Xwill be checked for
Xfirst. If it doesn't exist, then one is checked for in the users' home
Xdirectory.
X.PP
XNote: These options consist of things like:
X.PP
X - What commands are bound to keys 0-9
X.PP
X - What defaults to use instead of vi, arc, compress, etc
X.PP
X - What user mode to start up in (i.e. Ghost/eXpert)
X.PP
X - What directories to never scan
X.PP
X - What directories to always scan    
X.PP
XNote also that the latter three options will be overridden by the command line
Xoptions, if the command line options are used.
X.SH RELATED INFORMATION
X.B HDSCAN.DOC
X- Full information covering the
X.B hdscan
Xoptions.
________This_Is_The_END________
if test `wc -l < hdscan.man` -ne 120; then
	echo 'shar: hdscan.man was damaged during transit (should have been 120 bytes)'
fi
fi		; : end of overwriting check
exit 0