HuntnGather – Diff between revs 44 and 52
?pathlinks?
Rev 44 | Rev 52 | |||
---|---|---|---|---|
1 | Short: File indexing and search utilities. |
1 | Short: File indexing and search utilities. |
|
2 | Author: Wizardry and Steamworks |
2 | Author: Wizardry and Steamworks |
|
3 | Uploader: "Wizardry and Steamworks" <mail@grimore.org> |
3 | Uploader: "Wizardry and Steamworks" <mail@grimore.org> |
|
4 | Type: util/dir |
4 | Type: util/dir |
|
5 | Replaces: util/dir/HuntnGather.lha |
5 | Replaces: util/dir/HuntnGather.lha |
|
6 | Version: 1.7.5 |
6 | Version: 1.7.5 |
|
7 | Architecture: m68k-amigaos |
7 | Architecture: m68k-amigaos |
|
8 | |
8 | |
|
9 | Hunt & Gather - File search and indexing utilities. |
9 | Hunt & Gather - File search and indexing utilities. |
|
10 | (or Hunt'n'Gather bro, ghetto style) |
10 | (or Hunt'n'Gather bro, ghetto style) |
|
11 | |
11 | |
|
12 | © Copyright 2021 by Wizardry and Steamworks |
12 | © Copyright 2021 by Wizardry and Steamworks |
|
13 | |
13 | |
|
14 | Released under the MIT License, all rights reserved. |
14 | Released under the MIT License, all rights reserved. |
|
15 | |
15 | |
|
16 | -=:[ Changes ]:=- |
16 | -=:[ Changes ]:=- |
|
17 | |
17 | |
|
18 | 20211114: |
18 | 20211206: |
|
19 | |
19 | |
|
20 | * Rewrite and preparations for pooling memory the Amiga way. |
20 | * Compile pattern only once before searching through files. |
|
21 | |
21 | |
|
22 | -=:[ Introduction ]:=- |
22 | -=:[ Introduction ]:=- |
|
23 | |
23 | |
|
24 | |
24 | |
|
25 | "Hunt" and "Gather" are two utiltities for indexing and then searching |
25 | "Hunt" and "Gather" are two utiltities for indexing and then searching |
|
26 | fileswithin a drive or directory designed to speed up searching files. |
26 | fileswithin a drive or directory designed to speed up searching files. |
|
27 | |
27 | |
|
28 | The "Gather" utility is meant to index any path and generate a search |
28 | The "Gather" utility is meant to index any path and generate a search |
|
29 | database. The "Hunt" utility will then open the database generated by |
29 | database. The "Hunt" utility will then open the database generated by |
|
30 | Gather and look for files matching the string provided to "Hunt" as |
30 | Gather and look for files matching the string provided to "Hunt" as |
|
31 | parameter. |
31 | parameter. |
|
32 | |
32 | |
|
33 | The utility was designed to check large collections of icons but the |
33 | The utility was designed to check large collections of icons but the |
|
34 | indexing and the fast search results proved indispensable enough for a |
34 | indexing and the fast search results proved indispensable enough for a |
|
35 | self-standing program. |
35 | self-standing program. |
|
36 | |
36 | |
|
37 | -=:[ Design ]:=- |
37 | -=:[ Design ]:=- |
|
38 | |
38 | |
|
39 | "Hunt" and "Gather" are designed with constant memory usage in order |
39 | "Hunt" and "Gather" are designed with constant memory usage in order |
|
40 | to be suitable for all Amigas. Namely, the "Gather" utility will |
40 | to be suitable for all Amigas. Namely, the "Gather" utility will |
|
41 | search all files in a given path, sort the files in ascending order by |
41 | search all files in a given path, sort the files in ascending order by |
|
42 | using an external file-based merge sort. |
42 | using an external file-based merge sort. |
|
43 | |
43 | |
|
44 | Conversely, "Hunt" searchs files by reading lines from the database |
44 | Conversely, "Hunt" searchs files by reading lines from the database |
|
45 | without loading the entire database in RAM or by searching files |
45 | without loading the entire database in RAM or by searching files |
|
46 | again. |
46 | again. |
|
47 | |
47 | |
|
48 | The project adheres to the ANSI C standard and Amiga-centric semantics |
48 | The project adheres to the ANSI C standard and Amiga-centric semantics |
|
49 | are compiled conditionally (in case the "___AmigaOS__" macro is |
49 | are compiled conditionally (in case the "___AmigaOS__" macro is |
|
50 | defined at compile time). Otherwise, "Hunt" and "Gather" should run |
50 | defined at compile time). Otherwise, "Hunt" and "Gather" should run |
|
51 | under any platform that benefits from an ANSI C compiler. |
51 | under any platform that benefits from an ANSI C compiler. |
|
52 | |
52 | |
|
53 | The project is developed from scratch on a real Amiga using StormC. |
53 | The project is developed from scratch on a real Amiga using StormC. |
|
54 | |
54 | |
|
55 | -=:[ Usage ]:=- |
55 | -=:[ Usage ]:=- |
|
56 | |
56 | |
|
57 | The "Gather" utility is used to index a path. The following command: |
57 | The "Gather" utility is used to index a path. The following command: |
|
58 | |
58 | |
|
59 | Gather -c RAM: |
59 | Gather -c RAM: |
|
60 | |
60 | |
|
61 | will create a file in the S: directory named "gather.db". "Gather"is |
61 | will create a file in the S: directory named "gather.db". "Gather"is |
|
62 | verbose by default and will show the user what the utility is doing |
62 | verbose by default and will show the user what the utility is doing |
|
63 | but the behaviour can be changed with the "-q" (quiet) flag that will |
63 | but the behaviour can be changed with the "-q" (quiet) flag that will |
|
64 | make "Gather" print only errors. |
64 | make "Gather" print only errors. |
|
65 | |
65 | |
|
66 | In order to look for a file, the "Hunt" utility is then invoked with |
66 | In order to look for a file, the "Hunt" utility is then invoked with |
|
67 | an AmigaOS search pattern, for instance, the pattern "#?test#?: |
67 | an AmigaOS search pattern, for instance, the pattern "#?test#?: |
|
68 | |
68 | |
|
69 | Hunt #?test#? |
69 | Hunt #?test#? |
|
70 | |
70 | |
|
71 | "Hunt" will then search the database previously generated by the |
71 | "Hunt" will then search the database previously generated by the |
|
72 | "Gather" utility and will print out all the paths corresponding to the |
72 | "Gather" utility and will print out all the paths corresponding to the |
|
73 | files matching the supplied pattern. |
73 | files matching the supplied pattern. |
|
74 | |
74 | |
|
75 | In the previous example, in case any of the files previously indexed |
75 | In the previous example, in case any of the files previously indexed |
|
76 | by "Gather" contain the term "test", then the "Hunt" utility will |
76 | by "Gather" contain the term "test", then the "Hunt" utility will |
|
77 | display the path to the file. |
77 | display the path to the file. |
|
78 | |
78 | |
|
79 | At some point you might decide to add some other path to the search |
79 | At some point you might decide to add some other path to the search |
|
80 | database as well. In that case, "Gather" would be invoked with the |
80 | database as well. In that case, "Gather" would be invoked with the |
|
81 | "-a" option instead of "-c" in order to add the files: |
81 | "-a" option instead of "-c" in order to add the files: |
|
82 | |
82 | |
|
83 | Gather -a HDH0:Icons/ |
83 | Gather -a HDH0:Icons/ |
|
84 | |
84 | |
|
85 | "Gather" will then index the additional directory and add the new |
85 | "Gather" will then index the additional directory and add the new |
|
86 | files to the database. Adding a path to the index database will |
86 | files to the database. Adding a path to the index database will |
|
87 | require that "Gather" sorts the database again such that after adding |
87 | require that "Gather" sorts the database again such that after adding |
|
88 | the new files, "Gather" will proceed with sorting. |
88 | the new files, "Gather" will proceed with sorting. |
|
89 | |
89 | |
|
90 | Lastly, the "-r" parameter can be used with "Gather" to remove paths |
90 | Lastly, the "-r" parameter can be used with "Gather" to remove paths |
|
91 | that have been previously indexed. Let's say that you have indexed the |
91 | that have been previously indexed. Let's say that you have indexed the |
|
92 | following paths with "Gather": |
92 | following paths with "Gather": |
|
93 | |
93 | |
|
94 | RAM: |
94 | RAM: |
|
95 | HDH0:Icons/ |
95 | HDH0:Icons/ |
|
96 | |
96 | |
|
97 | but now you would like to remove the "RAM:" path and all the files |
97 | but now you would like to remove the "RAM:" path and all the files |
|
98 | indexed below that path. In that case, you would issue a "Gather" |
98 | indexed below that path. In that case, you would issue a "Gather" |
|
99 | command with the "-r" parameter: |
99 | command with the "-r" parameter: |
|
100 | |
100 | |
|
101 | Gather -r RAM: |
101 | Gather -r RAM: |
|
102 | |
102 | |
|
103 | and "Gather" will remove all files matching the "RAM:" path. Removing |
103 | and "Gather" will remove all files matching the "RAM:" path. Removing |
|
104 | a path with the "-r" parameter does not take a long time compared to |
104 | a path with the "-r" parameter does not take a long time compared to |
|
105 | adding files to the database. |
105 | adding files to the database. |
|
106 | |
106 | |
|
107 | -=:[ Gather ]:=- |
107 | -=:[ Gather ]:=- |
|
108 | |
108 | |
|
109 | "Gather" requires that one of the following parameters is specified: |
109 | "Gather" requires that one of the following parameters is specified: |
|
110 | * -a (add files to an already existing database), |
110 | * -a (add files to an already existing database), |
|
111 | * -r (remove files from an already existing database), |
111 | * -r (remove files from an already existing database), |
|
112 | * -c (delete the previous database file and create a new database). |
112 | * -c (delete the previous database file and create a new database). |
|
113 | |
113 | |
|
114 | The "Gather" utility takes several paths as parameters representing |
114 | The "Gather" utility takes several paths as parameters representing |
|
115 | the paths to be indexed; for example, all the following paths are |
115 | the paths to be indexed; for example, all the following paths are |
|
116 | valid: |
116 | valid: |
|
117 | |
117 | |
|
118 | RAM: |
118 | RAM: |
|
119 | DH0:System/ |
119 | DH0:System/ |
|
120 | |
120 | |
|
121 | When the "Gather" utility runs, a database is created at "S:gather.db" |
121 | When the "Gather" utility runs, a database is created at "S:gather.db" |
|
122 | containing all the found files. |
122 | containing all the found files. |
|
123 | |
123 | |
|
124 | "Gather" is also happy to work with a different database file other |
124 | "Gather" is also happy to work with a different database file other |
|
125 | than the default database at "S:gather.db" by passing the "-d" |
125 | than the default database at "S:gather.db" by passing the "-d" |
|
126 | parameter when "Gather" is invoked. For instance, the following |
126 | parameter when "Gather" is invoked. For instance, the following |
|
127 | command invocation will create the database file at "T:gather.db" and |
127 | command invocation will create the database file at "T:gather.db" and |
|
128 | index the paths "RAM:" and "HDH0:Icons": |
128 | index the paths "RAM:" and "HDH0:Icons": |
|
129 | |
129 | |
|
130 | Gather -d T:gather.db RAM: HDH0:Icons |
130 | Gather -d T:gather.db RAM: HDH0:Icons |
|
131 | |
131 | |
|
132 | Conversely, the "Hunt" utility can then be used to search specified |
132 | Conversely, the "Hunt" utility can then be used to search specified |
|
133 | database files: |
133 | database files: |
|
134 | |
134 | |
|
135 | Hunt -d T:gather.db #?test?# |
135 | Hunt -d T:gather.db #?test?# |
|
136 | |
136 | |
|
137 | The previous "Hunt" command will search a database file located at |
137 | The previous "Hunt" command will search a database file located at |
|
138 | "T:gather.db" for all files matching the pattern "#?test?". |
138 | "T:gather.db" for all files matching the pattern "#?test?". |
|
139 | |
139 | |
|
140 | -=:[ Hunt ]:=- |
140 | -=:[ Hunt ]:=- |
|
141 | |
141 | |
|
142 | "Hunt" is the counterpart to "Gather" and will search a given database |
142 | "Hunt" is the counterpart to "Gather" and will search a given database |
|
143 | generated by the "Gather" utility for files matching the terms passed |
143 | generated by the "Gather" utility for files matching the terms passed |
|
144 | to "Hunt" on the command line. |
144 | to "Hunt" on the command line. |
|
145 | |
145 | |
|
146 | For instance: |
146 | For instance: |
|
147 | |
147 | |
|
148 | Hunt #?test#? |
148 | Hunt #?test#? |
|
149 | |
149 | |
|
150 | will search all files in the "Gather" database "S:gather.db" for the |
150 | will search all files in the "Gather" database "S:gather.db" for the |
|
151 | term "test". If any file within the database partially matches the |
151 | term "test". If any file within the database partially matches the |
|
152 | term "test", then "Hunt" will display the path on the command line. |
152 | term "test", then "Hunt" will display the path on the command line. |
|
153 | |
153 | |
|
154 | "Hunt" uses AmigaOS pattern for matching the file names on AmigaOS. |
154 | "Hunt" uses AmigaOS pattern for matching the file names on AmigaOS. |
|
155 | |
155 | |
|
156 | -=:[ Notes ]:=- |
156 | -=:[ Notes ]:=- |
|
157 | |
157 | |
|
158 | * The "Gather" utility will be slow and that is the intended |
158 | * The "Gather" utility will be slow and that is the intended |
|
159 | behaviour: slow indexing with "Gather", fast searching with "Hunt". |
159 | behaviour: slow indexing with "Gather", fast searching with "Hunt". |
|
160 | |
160 | |
|
161 | * Temporary files might end up created in the same location where the |
161 | * Temporary files might end up created in the same location where the |
|
162 | "Gather" utility is invoked. Traditionally the temporary directory |
162 | "Gather" utility is invoked. Traditionally the temporary directory |
|
163 | on AmigaOS is mainted in RAM but "Gather" cannot use RAM since it |
163 | on AmigaOS is mainted in RAM but "Gather" cannot use RAM since it |
|
164 | intends to index very large hierarchies. Fortunately, "Gather"will |
164 | intends to index very large hierarchies. Fortunately, "Gather"will |
|
165 | delete the temporary files once "Gather" is done indexing. |
165 | delete the temporary files once "Gather" is done indexing. |
|
166 | |
166 | |
|
167 | Nevertheless, in case you intend to index a large filesystem |
167 | Nevertheless, in case you intend to index a large filesystem |
|
168 | hierarchy please make sure that you invoke "Gather" from a directory |
168 | hierarchy please make sure that you invoke "Gather" from a directory |
|
169 | that is able to hold large temporary files. |
169 | that is able to hold large temporary files. |
|
170 | |
170 | |
|
171 | * The output of the "Hunt" utility can be combined with the pipe |
171 | * The output of the "Hunt" utility can be combined with the pipe |
|
172 | operator (in newer AmigaOS releases) or the PIPE: handler on older |
172 | operator (in newer AmigaOS releases) or the PIPE: handler on older |
|
173 | AmigaOS releases in order to to perform some action on the found |
173 | AmigaOS releases in order to to perform some action on the found |
|
174 | files. For example, using Thomas Radtke's "from" utility located at: |
174 | files. For example, using Thomas Radtke's "from" utility located at: |
|
175 | |
175 | |
|
176 | http://aminet.net/package/util/batch/from |
176 | http://aminet.net/package/util/batch/from |
|
177 | |
177 | |
|
178 | and the Workbench 3.2 "MD5Sum" utility, you could print out the MD5 |
178 | and the Workbench 3.2 "MD5Sum" utility, you could print out the MD5 |
|
179 | hashes of all files indexed by "Gather" ending in "#?.library: |
179 | hashes of all files indexed by "Gather" ending in "#?.library: |
|
180 | |
180 | |
|
181 | Hunt #?.library | from - md5sum $1 |
181 | Hunt #?.library | from - md5sum $1 |
|
182 | |
182 | |
|
183 | Or you could generate a list of versions of all libraries indexed |
183 | Or you could generate a list of versions of all libraries indexed |
|
184 | with the "Gahter" utility: |
184 | with the "Gahter" utility: |
|
185 | |
185 | |
|
186 | Hunt #?.library | from - version $1 |
186 | Hunt #?.library | from - version $1 |
|
187 | |
187 | |
|
188 | -=:[ Source ]:=- |
188 | -=:[ Source ]:=- |
|
189 | |
189 | |
|
190 | The project is open sourced and licensed under MIT. The source code |
190 | The project is open sourced and licensed under MIT. The source code |
|
191 | is included in the AmiNET release or can be checked out via subversion |
191 | is included in the AmiNET release or can be checked out via subversion |
|
192 | from the Wizardry and Steamworks repository: |
192 | from the Wizardry and Steamworks repository: |
|
193 | |
193 | |
|
194 | svn co http://svn.grimore.org/HuntnGather |
194 | svn co http://svn.grimore.org/HuntnGather |
|
195 | |
195 | |
|
196 | StormC was used as the developer environment. |
196 | StormC was used as the developer environment. |
|
197 | |
197 | |
|
198 | -=:[ Mentions ]:=- |
198 | -=:[ Mentions ]:=- |
|
199 | |
199 | |
|
200 | The code includes a shim for "getopt" in order to process command line |
200 | The code includes a shim for "getopt" in order to process command line |
|
201 | parameters on AmigaOS just like one would on a POSIX sytem. The shim |
201 | parameters on AmigaOS just like one would on a POSIX sytem. The shim |
|
202 | is created by Daniel J. Barrett, barrett@cs.umass.edu and is |
202 | is created by Daniel J. Barrett, barrett@cs.umass.edu and is |
|
203 | available on AmiNET: |
203 | available on AmiNET: |
|
204 | |
204 | |
|
205 | http://aminet.net/package/dev/misc/GetOpt-1.3 |
205 | http://aminet.net/package/dev/misc/GetOpt-1.3 |
|
206 | |
206 | |
|
207 | -=:[ Contact ]:=- |
207 | -=:[ Contact ]:=- |
|
208 | |
208 | |
|
209 | E-Mail(tor): |
209 | E-Mail(tor): |
|
210 | |
210 | |
|
211 | office@3wymlmcsvxiaqzmbepsdawqpk6o2qsk65jhms72qqjulk5u4bgmvs3qd.onion |
211 | office@3wymlmcsvxiaqzmbepsdawqpk6o2qsk65jhms72qqjulk5u4bgmvs3qd.onion |
|
212 | |
212 | |
|
213 | Website: https://grimore.org/amiga/hunt_and_gather |
213 | Website: https://grimore.org/amiga/hunt_and_gather |
|
214 | Website(tor): |
214 | Website(tor): |
|
215 | |
215 | |
|
216 | http://3wymlmcsvxiaqzmbepsdawqpk6o2qsk65jhms72qqjulk5u4bgmvs3qd.onion/ |
216 | http://3wymlmcsvxiaqzmbepsdawqpk6o2qsk65jhms72qqjulk5u4bgmvs3qd.onion/ |
|
217 | |
217 | |
|
218 | Discord: https://discord.gg/k9kyDsa |
218 | Discord: https://discord.gg/k9kyDsa |
|
219 | |
219 | |
|
220 | |
220 | |