AminetAminet
Search:
84451 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/dir/HuntnGather.lha

Mirror:Random
Showing:ppc-powerupgeneric
No screenshot available
Short:File indexing and search utilities.
Author:Wizardry and Steamworks
Uploader:"Wizardry and Steamworks" <mail grimore org>
Type:util/dir
Version:1.7.7
Replaces:util/dir/HuntnGather.lha
Architecture:m68k-amigaos
Date:2021-12-09
Download:http://aminet.net/util/dir/HuntnGather.lha - View contents
Readme:http://aminet.net/util/dir/HuntnGather.readme
Downloads:1597

             Hunt & Gather - File search and indexing utilities.
                    (or Hunt'n'Gather bro, ghetto style)

                © Copyright 2021 by Wizardry and Steamworks

           Released under the MIT License, all rights reserved.

-=:[ Changes ]:=-

20211206:
	* Compile pattern only once before searching through files.

-=:[ Introduction ]:=-


    "Hunt" and "Gather" are two utiltities for indexing and then searching
    fileswithin a drive or directory designed to speed up searching files.

    The "Gather" utility is meant to index any path and generate a search
    database. The "Hunt" utility will then open the database generated by
    Gather and look for files matching the string provided to "Hunt" as
    parameter.

    The utility was designed to check large collections of icons but the
    indexing and the fast search results proved indispensable enough for a
    self-standing program.

-=:[ Design ]:=-

    "Hunt" and "Gather" are designed with constant memory usage in order
    to be suitable for all Amigas. Namely, the "Gather" utility will
    search all files in a given path, sort the files in ascending order by
    using an external file-based merge sort.

    Conversely, "Hunt" searchs files by reading lines from the database
    without loading the entire database in RAM or by searching files
    again.

    The project adheres to the ANSI C standard and Amiga-centric semantics
    are compiled conditionally (in case the "___AmigaOS__" macro is
    defined at compile time). Otherwise, "Hunt" and "Gather" should run
    under any platform that benefits from an ANSI C compiler.
    
    The project is developed from scratch on a real Amiga using StormC.

-=:[ Usage ]:=-

    The "Gather" utility is used to index a path. The following command:

    Gather -c RAM:

    will create a file in the S: directory named "gather.db". "Gather"is
    verbose by default and will show the user what the utility is doing
    but the behaviour can be changed with the "-q" (quiet) flag that will
    make "Gather" print only errors.

    In order to look for a file, the "Hunt" utility is then invoked with
    an AmigaOS search pattern, for instance, the pattern "#?test#?:

    Hunt #?test#?

    "Hunt" will then search the database previously generated by the
    "Gather" utility and will print out all the paths corresponding to the
    files matching the supplied pattern.
    
    In the previous example, in case any of the files previously indexed
    by "Gather" contain the term "test", then the "Hunt" utility will
    display the path to the file.
    
    At some point you might decide to add some other path to the search
    database as well. In that case, "Gather" would be invoked with the
    "-a" option instead of "-c" in order to add the files:
    
    Gather -a HDH0:Icons/
    
    "Gather" will then index the additional directory and add the new
    files to the database. Adding a path to the index database will
    require that "Gather" sorts the database again such that after adding
    the new files, "Gather" will proceed with sorting.
    
    Lastly, the "-r" parameter can be used with "Gather" to remove paths
    that have been previously indexed. Let's say that you have indexed the
    following paths with "Gather":
    
    RAM:
    HDH0:Icons/
    
    but now you would like to remove the "RAM:" path and all the files
    indexed below that path. In that case, you would issue a "Gather"
    command with the "-r" parameter:
    
    Gather -r RAM:
    
    and "Gather" will remove all files matching the "RAM:" path. Removing
    a path with the "-r" parameter does not take a long time compared to
    adding files to the database.

-=:[ Gather ]:=-

    "Gather" requires that one of the following parameters is specified:
      * -a (add files to an already existing database),
      * -r (remove files from an already existing database),
      * -c (delete the previous database file and create a new database).

    The "Gather" utility takes several paths as parameters representing
    the paths to be indexed; for example, all the following paths are
    valid:

    RAM:
    DH0:System/

    When the "Gather" utility runs, a database is created at "S:gather.db"
    containing all the found files.
	
    "Gather" is also happy to work with a different database file other
    than the default database at "S:gather.db" by passing the "-d"
    parameter when "Gather" is invoked. For instance, the following
    command invocation will create the database file at "T:gather.db" and
    index the paths "RAM:" and "HDH0:Icons":
	
    Gather -d T:gather.db RAM: HDH0:Icons
	
    Conversely, the "Hunt" utility can then be used to search specified
    database files:
	
    Hunt -d T:gather.db #?test?#
	
    The previous "Hunt" command will search a database file located at
    "T:gather.db" for all files matching the pattern "#?test?".

-=:[ Hunt ]:=-

    "Hunt" is the counterpart to "Gather" and will search a given database
    generated by the "Gather" utility for files matching the terms passed
    to "Hunt" on the command line.

    For instance:

	Hunt #?test#?

    will search all files in the "Gather" database "S:gather.db" for the
    term "test". If any file within the database partially matches the
    term "test", then "Hunt" will display the path on the command line.
    
    "Hunt" uses AmigaOS pattern for matching the file names on AmigaOS.

-=:[ Notes ]:=-

    * The "Gather" utility will be slow and that is the intended
      behaviour: slow indexing with "Gather", fast searching with "Hunt".
      
    * Temporary files might end up created in the same location where the
      "Gather" utility is invoked. Traditionally the temporary directory
      on AmigaOS is mainted in RAM but "Gather" cannot use RAM since it
      intends to index very large hierarchies. Fortunately, "Gather"will 
      delete the temporary files once "Gather" is done indexing.
      
      Nevertheless, in case you intend to index a large filesystem
      hierarchy please make sure that you invoke "Gather" from a directory
      that is able to hold large temporary files.

    * The output of the "Hunt" utility can be combined with the pipe
      operator (in newer AmigaOS releases) or the PIPE: handler on older
      AmigaOS releases in order to to perform some action on the found
      files. For example, using Thomas Radtke's "from" utility located at:
      
      http://aminet.net/package/util/batch/from
      
      and the Workbench 3.2 "MD5Sum" utility, you could print out the MD5
      hashes of all files indexed by "Gather" ending in "#?.library:
      
      Hunt #?.library | from - md5sum $1
      
      Or you could generate a list of versions of all libraries indexed
      with the "Gahter" utility:
      
      Hunt #?.library | from - version $1
       
-=:[ Source ]:=-

    The project is open sourced and licensed under MIT. The source code
    is included in the AmiNET release or can be checked out via subversion
    from the Wizardry and Steamworks repository:
    
    svn co http://svn.grimore.org/HuntnGather
    
    StormC was used as the developer environment.
    
-=:[ Mentions ]:=-

    The code includes a shim for "getopt" in order to process command line
    parameters on AmigaOS just like one would on a POSIX sytem. The shim
    is  created by Daniel J. Barrett, barrett at cs.umass.edu and is
    available on AmiNET:
    
    http://aminet.net/package/dev/misc/GetOpt-1.3
    
-=:[ Contact ]:=-

    E-Mail(tor): 

office at 3wymlmcsvxiaqzmbepsdawqpk6o2qsk65jhms72qqjulk5u4bgmvs3qd.onion

    Website: https://grimore.org/amiga/hunt_and_gather
    Website(tor): 

http://3wymlmcsvxiaqzmbepsdawqpk6o2qsk65jhms72qqjulk5u4bgmvs3qd.onion/

    Discord: https://discord.gg/k9kyDsa
                                              


Contents of util/dir/HuntnGather.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[Amiga]                   1524    2058  74.1% -lh5- e2c3 Dec 31 05:11 Hunt & Gather/C.info
[Amiga]                  15715   30672  51.2% -lh5- 84d7 Dec 31 01:33 Hunt & Gather/C/Gather.00
[Amiga]                  15630   30236  51.7% -lh5- 4596 Dec 31 01:36 Hunt & Gather/C/Gather.20
[Amiga]                  14250   28092  50.7% -lh5- 9ce2 Dec 31 01:33 Hunt & Gather/C/Hunt.00
[Amiga]                  14166   27728  51.1% -lh5- 0522 Dec 31 01:36 Hunt & Gather/C/Hunt.20
[Amiga]                   1531    2058  74.4% -lh5- e04c Dec 31 05:11 Hunt & Gather/Gather.info
[Amiga]                  15630   30236  51.7% -lh5- 4596 Dec 31 01:36 Hunt & Gather/Gather/Gather
[Amiga]                   1270    3282  38.7% -lh5- 46fc Dec 30 12:42 Hunt & Gather/Gather/Gather.c
[Amiga]                   2083    2663  78.2% -lh5- 4e24 Dec 31 01:36 Hunt & Gather/Gather/Gather.c.info
[Amiga]                    960    2529  38.0% -lh5- efb1 Dec 30 07:34 Hunt & Gather/Gather/Gather.c~
[Amiga]                   1136    3715  30.6% -lh5- d71f Dec 31 01:36 Hunt & Gather/Gather/Gather.link
[Amiga]                   3532   27035  13.1% -lh5- 2f4a Dec 31 01:36 Hunt & Gather/Gather/Gather.map
[Amiga]                      0       0 100.0% -lh0- 0000 Dec 28 10:24 Hunt & Gather/Gather/Gather.qiq
[Amiga]                   1683    2909  57.9% -lh5- 929b Dec 28 10:24 Hunt & Gather/Gather/Gather.qiq.info
[Amiga]                    648    1925  33.7% -lh5- fb0a Dec 31 01:37 Hunt & Gather/Gather/Gather.?
[Amiga]                   1502    1973  76.1% -lh5- b6d7 Dec 31 01:37 Hunt & Gather/Gather/Gather.?.info
[Amiga]                   8607   18150  47.4% -lh5- 2c8e Dec 31 01:36 Hunt & Gather/Gather/objects_debug/Gather.debug
[Amiga]                    922    1740  53.0% -lh5- 702a Dec 31 01:36 Hunt & Gather/Gather/objects_debug/Gather.o
[Amiga]                   7267   15050  48.3% -lh5- 9445 Dec 31 01:36 Hunt & Gather/Gather/objects_debug/StringStack.debug
[Amiga]                    561    1120  50.1% -lh5- 91ec Dec 31 01:36 Hunt & Gather/Gather/objects_debug/StringStack.o
[Amiga]                    797    3133  25.4% -lh5- eec8 Dec 30 07:02 Hunt & Gather/Gather/StringStack.c
[Amiga]                   2059    2631  78.3% -lh5- c275 Dec 30 07:02 Hunt & Gather/Gather/StringStack.c.info
[Amiga]                    360     942  38.2% -lh5- 4825 Dec 30 07:02 Hunt & Gather/Gather/StringStack.h
[Amiga]                   2028    2578  78.7% -lh5- 8088 Dec 30 07:02 Hunt & Gather/Gather/StringStack.h.info
[Amiga]                   1057    2362  44.8% -lh5- 99d6 Dec 31 02:05 Hunt & Gather/Hunt & Gather.doc
[Amiga]                   1233    1866  66.1% -lh5- f44a Dec 31 05:11 Hunt & Gather/Hunt & Gather.doc.info
[Amiga]                   1517    2058  73.7% -lh5- 62d5 Dec 31 05:11 Hunt & Gather/Hunt.info
[Amiga]                  14166   27728  51.1% -lh5- 0522 Dec 31 01:36 Hunt & Gather/Hunt/Hunt
[Amiga]                    968    2527  38.3% -lh5- d958 Dec 30 12:42 Hunt & Gather/Hunt/Hunt.c
[Amiga]                   2061    2632  78.3% -lh5- 5053 Dec 31 01:36 Hunt & Gather/Hunt/Hunt.c.info
[Amiga]                   1052    3352  31.4% -lh5- e6fa Dec 31 01:36 Hunt & Gather/Hunt/Hunt.link
[Amiga]                   3258   24825  13.1% -lh5- 007d Dec 31 01:36 Hunt & Gather/Hunt/Hunt.map
[Amiga]                      0       0 100.0% -lh0- 0000 Dec 30 06:46 Hunt & Gather/Hunt/Hunt.qiq
[Amiga]                   1684    2909  57.9% -lh5- 2e8b Dec 30 06:46 Hunt & Gather/Hunt/Hunt.qiq.info
[Amiga]                    614    1647  37.3% -lh5- cdfd Dec 31 01:37 Hunt & Gather/Hunt/Hunt.?
[Amiga]                   1501    1973  76.1% -lh5- 677f Dec 31 01:37 Hunt & Gather/Hunt/Hunt.?.info
[Amiga]                   7992   16152  49.5% -lh5- f7c4 Dec 31 01:36 Hunt & Gather/Hunt/objects_debug/Hunt.debug
[Amiga]                    767    1340  57.2% -lh5- bf75 Dec 31 01:36 Hunt & Gather/Hunt/objects_debug/Hunt.o
[Amiga]                    602    1739  34.6% -lh5- 3fc2 Dec 31 05:11 Hunt & Gather/Install
[Amiga]                   1588    2950  53.8% -lh5- b3e2 Dec 31 05:11 Hunt & Gather/Install.info
[Amiga]                    492    1053  46.7% -lh5- b960 Dec 31 05:11 Hunt & Gather/InstallerProject
[Amiga]                   1899    2914  65.2% -lh5- 69ac Dec 31 05:11 Hunt & Gather/InstallerProject.info
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        42 files  156312  342482  45.6%            Jan  1 06:04

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>