added/updated some headers for usage in feisty meow code. the uva_header
[feisty_meow.git] / docs / perl_tools.html
1 <!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <head>
4   <meta http-equiv="Content-Type"
5  content="text/html; charset=iso-8859-1">
6   <meta name="Author" content="Fred T. Hamster">
7   <meta name="generator"
8  content="Mozilla/5.0 (X11; U; Linux i686; en-US) [Mozilla]">
9   <meta name="Description"
10  content="Open Source Perl for Your Perusement">
11   <meta name="KeyWords"
12  content="reusable, open source, perl, shell, script, recursive, diff, snarf, YETI, free, source code, example, filename, snarfer">
13   <title>YETIcode Perl Scripts</title>
14   <meta content="Fred T. Hamster" name="author">
15   <meta
16  content="Scripts for backing up hierarchies, generating documents from other documents, etc etc."
17  name="description">
18 </head>
19 <body
20  style="background-image: url(pics/celtic_destiny14.jpg); background-color: rgb(0, 0, 0); color: rgb(255, 255, 153);"
21  alink="#ffcc00" link="#66ff99" vlink="#00cc00">
22 <h3>&nbsp; </h3>
23 <center>
24 <table bgcolor="#330000" border="4" cellpadding="0" cellspacing="0"
25  cols="1" width="92%">
26   <tbody>
27     <tr>
28       <td>
29       <center>
30       <h1><a href="http://yeticode.org/">YETIcode</a> Open Source Perl
31 Scripts</h1>
32       <h2>Some Hopefully Useful GPL-Licensed Perl Code<br>
33       </h2>
34       </center>
35       <center>Contributed by Chris Koeritz (<a
36  href="mailto:%20koeritz@gruntose.com">Koeritz@Gruntose.COM</a>) <br>
37 See the <a href="http://www.gruntose.com/Info/GNU/GPL.html">GNU Public
38 License</a> for details of licensing.<span style="font-style: italic;"></span><br>
39       </center>
40       <h4>Caveats:</h4>
41       <ol>
42         <li>No warranty, express, implied or imagined, is offered for
43 these files.&nbsp; If you destroy your life by running one of them, I
44 will have sympathy, but that's about it.</li>
45         <li>Some of these shell scripts depend on environment variables.&nbsp;
46 The most frequent case of this is FEISTY_MEOW_DIR, which should point to the
47 top-level
48 directory where the YETIcode scripts are stored on your
49 machine. &nbsp; This variable is set by default when the scripts are in
50 the ~/yeti folder.&nbsp; Consult your operating
51 system documentation if you are
52 unfamiliar with the concept or management of environment variables.</li>
53         <li>These files are provided as possibly useful shell scripts
54 rather than as full-fledged reusable and object oriented components.</li>
55         <li>Improvements and contributions are gladly accepted.&nbsp;
56 They will be processed as fast as our schedule permits.&nbsp; Please
57 send any changes to the Gruntose Curator at <a
58  href="mailto:%20fred@gruntose.com">fred@gruntose.com</a> .</li>
59         <li>These files are mostly portable between Unix and the
60 various Windoze OSes, but in many cases you may want to fix the
61 defaults or path names to make them more suitable for your own needs.</li>
62         <li>Some of the scripts invoke external programs that are
63 available for most Unixes.&nbsp; For Windoze users, a set of GNU Unix
64 utilities is available at "<a href="http://www.mingw.org/">http://www.mingw.org/</a>".</li>
65         <li>An alternative, but not recommended, GNU suite is
66 at "<a href="http://www.cygwin.com/">http://www.cygwin.com/</a>".</li>
67         <li><span style="color: rgb(255, 255, 204);">Direct Cognition</span>:
68 View the scripts directory itself rather than navigating with the links
69 below: <a href=".">scripts</a>.</li>
70       </ol>
71       </td>
72     </tr>
73   </tbody>
74 </table>
75 </center>
76 <h3>&nbsp; </h3>
77 <center>
78 <table bgcolor="#330000" border="4" cellpadding="0" cellspacing="0"
79  cols="1" width="92%">
80   <tbody>
81     <tr>
82       <td>
83       <h2>Library Files<br>
84       </h2>
85       <blockquote>
86         <h3><a href="../text/diff_lib.pl">diff_lib.pl</a></h3>
87         <blockquote>The "differ" utilities can be used to compare two
88 directories of text or binary files against each other.&nbsp; The two
89 directories are presumably close in contents.&nbsp; This can be useful
90 when one is revising a set of files and wants to synchronize an older
91 copy against a newer version.&nbsp; Support for "<a href="#differ">differ.pl</a>"
92 is provided
93 here.</blockquote>
94         <h3> <a name="filename helper"></a><a
95  href="../files/filename_helper.pl">filename_helper.pl</a></h3>
96         <blockquote>Contains a handy set of utilities for manipulating
97 filenames.&nbsp; These can help to make perl scripts portable across
98 the two well-known types of filename separators ('/' and '\').&nbsp;
99 They also provide support for ripping up filenames into their
100 components.</blockquote>
101         <h3> <a href="../core/inc_num.pl">inc_num.pl</a></h3>
102         <blockquote>This is a simple utility that manages a file with a
103 number in it.&nbsp; This is somewhat more useful than it sounds.&nbsp;
104 Functions are provided to get the current number and to change the
105 number.</blockquote>
106         <h3> </h3>
107         <h3> <a href="../archival/shared_snarfer.pl">shared_snarfer.pl</a></h3>
108         <blockquote>This library supports the "snarf" utilities.&nbsp;
109 The
110 utilities manipulate archive files with the ".snarf" extension.&nbsp;
111 These
112 packed
113 snarf files are compressed chunks of directory hierarchies.&nbsp; Bob
114 files
115 are useful because they track a number per distinct "snarf" types that
116 is
117 used to make uniquely named new archives of the appropriate type.&nbsp;
118 This
119 number is an ever increasing integer that's stored in a well-known
120 (configurable) location.&nbsp; When a snarf file is unpacked (using the
121 "unsnarf" tool), the number is updated on the local machine so that the
122 next generated file will
123 be one greater than the previous number.&nbsp; If one is travelling
124 between
125 two machines with the same snarf file, this will have the effect of
126 keeping
127 the number updated on both sides.
128         </blockquote>
129         <h3><a href="../files/zap_the_dir.pl">zap_the_dir.pl</a></h3>
130         <blockquote>Support for the zapdirs utility.&nbsp; This library
131 cleans out the directory that it is passed by removing files that are
132 not considered important (using "<a href="#filename%20helper">filename_helper.pl</a>
133 ").&nbsp; The list of important files is something you might want to
134 look at to ensure that you won't get burned by zapdirs.</blockquote>
135       </blockquote>
136       </td>
137     </tr>
138   </tbody>
139 </table>
140 </center>
141 <h3>&nbsp; </h3>
142 <center>
143 <table bgcolor="#330000" border="4" cellpadding="0" cellspacing="0"
144  cols="1" width="92%">
145   <tbody>
146     <tr>
147       <td>
148       <h2>Applications</h2>
149       <blockquote>
150         <h3> <a href="../text/add_cr.pl">add_cr.pl</a></h3>
151         <blockquote>Processes Unix format text files for pcdos by
152 forcing the line endings to be Carriage Return plus Line Feed (CRLF).</blockquote>
153         <h4> </h4>
154         <h3><a href="../cgi/cgi_display.pl">cgi_display.pl</a></h3>
155         <blockquote>Turns the files passed on the command line into a
156 stream of CGI compatible text output. The javascript show_file method
157 (see the
158 source for this page) is preferred since it is lighter weight and
159 doesn't
160 need cgi, but there are some situations where cgi is the only option
161 (older
162 browsers or requirements of no javascript).</blockquote>
163         <h4> </h4>
164         <h3> <a href="../files/change_endings.pl">change_endings.pl</a></h3>
165         <blockquote>Replaces the suffix of all filenames in the current
166 directory
167 with a different suffix. &nbsp;Suffix here is defined as the set of
168 characters
169 after the last period ('.') in the name. &nbsp;Note this will not work
170 for
171 names without suffices.</blockquote>
172         <h3> </h3>
173         <h3><a href="../text/cpdiff.pl">cpdiff.pl</a></h3>
174         <blockquote>Copies files from a source directory into a
175 destination directory.&nbsp; The files are only copied when they are
176 missing in the destination or when the destination version has
177 different contents.&nbsp; The syntax looks like this:<br>
178 &nbsp;&nbsp;&nbsp; cpdiff&nbsp; source&nbsp; destination<br>
179 The assumption is that the files in the source directory are somehow
180 better, newer or more complete than the set of files in the destination.<br>
181         </blockquote>
182         <h3><a href="../text/cpdiffnow.pl">cpdiffnow.pl</a></h3>
183         <blockquote> Similar to cpdiff, but this utility sets the
184 destination file's time stamp to "now".&nbsp; This should cause the new
185 or changed files in the destination directory to be more recent than
186 anything else in there.&nbsp; This is helpful sometimes for forcing
187 compilation of modified source files.<br>
188         </blockquote>
189         <h4> </h4>
190         <h3><a href="../rev_control/cvs_fix.pl">cvs_fix.pl</a></h3>
191         <blockquote>Wraps the cygwin cvs command for pcdos/win32.
192 &nbsp;Any
193 unfriendly backward slashes are flipped to be forward slashes.<br>
194         </blockquote>
195         <h3> </h3>
196         <h3><a name="differ"></a><a
197  href="../text/differ.pl">differ.pl</a></h3>
198         <blockquote>Compares two directory hierarchies and the files
199 they
200 contain.&nbsp; The first parameter is a directory
201 to compare against "this" directory;
202 every subdirectory "here" will be traversed in order to build the
203 output file that shows the differences.&nbsp; An optional second
204 argument can be used to specify a different directory than the current
205 one as the source of the comparison (the first argument is always the
206 destination of the comparison).</blockquote>
207         <h3> <a href="../files/filedump.pl">filedump.pl</a></h3>
208         <blockquote>Collects the contents of the files whose names are
209 passed on the command line into one gigundo stream which is passed to
210 standard output. The output can be piped into another file as desired.</blockquote>
211         <h3> <a href="../core/generate_aliases.pl">generate_aliases.pl</a></h3>
212         <blockquote>Performs some useful activities for the YETI shell
213 environment.&nbsp; Using the environment variable for FEISTY_MEOW_SCRIPTS (which
214 is set in the appropriate startup files to be the shell scripts
215 directory, where all this stuff lives), generate_aliases will create
216 all of the aliases files for the combinations of operating systems and
217 types of shells supported.&nbsp; Currently this includes Linux, Unix,
218 PCDOS, OS/2 and MS-WIN32 (9x, NT, 2K, XP, etc) for
219 supported operating systems.&nbsp; The shell languages supported are
220 dos's command, nt's cmd, unix's sh and bash, and perl.&nbsp; This script will also look for
221 any files ending in ".sh" or ".pl" and it will create aliases for them
222 in forms appropriate to the different shells. &nbsp;The .zz_auto_gen
223 subdirectory
224 is created under the home directory (or under TMP in DOS and Win32) as
225 a storage place for the generated
226 files.</blockquote>
227         <h4> </h4>
228         <h3> <a href="../users/goodbye.pl">goodbye.pl</a></h3>
229         <blockquote>A logout script for exiting from a shell; it prints
230 a message using the nechung oracle for the user's benefit and starts a
231 byejob before exiting. The byejob will wait for a few seconds, then
232 clear the screen and print another fortune. It attempts to leave the
233 screen looking like a
234 standard login, but with an extra fortune.</blockquote>
235         <h3> </h3>
236         <h4> </h4>
237         <h3> <a href="../text/new_sig.pl">new_sig.pl</a></h3>
238         <blockquote>Generates a signature file from the nechung
239 database
240 using the 'nechung' application. &nbsp;See the <a
241  href="http://hoople.org/">HOOPLE library</a> for the nechung
242 application.
243 &nbsp;The database for nechung resides in the <a href="#download">whole
244 YETI
245 package</a> in "yeti/database".</blockquote>
246         <h3> </h3>
247         <h3> <a href="../files/renlower.pl">renlower.pl</a></h3>
248         <blockquote>Renames all of the files passed on the command line
249 such that they are only in lower-case.&nbsp; Useful if you're tired of
250 passing mistakenly re-capitalized names from a defective 8.3 OS (e.g.
251 Doze95/98) to
252 a file system where you care about the case.</blockquote>
253         <h3><a href="../processes/runner.pl">runner.pl</a></h3>
254         <blockquote>Finds all executable files in the current directory
255 (and subdirectories) and runs them.&nbsp; The output of the programs is
256 sent to standard output.&nbsp; Standard error is used to report which
257 file is being worked on, plus the running programs' own standard error
258 streams are merged into runner's standard error stream.&nbsp; This
259 makes it nice to do something like:<br>
260 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; runner &gt;runs.log<br>
261 where the runs.log file will contain the output of each program that
262 was executed and the console will be sent messages as each program is
263 started and finished (and errors show up at the console also).<br>
264         </blockquote>
265         <h3> <a name="safedel"></a><a
266  href="../files/safedel.pl">safedel.pl</a></h3>
267         <blockquote>Makes deleting files and directories a little less
268 nerve-wracking.&nbsp; If you substitute safedel as an alias for rm or
269 del or deltree or whatever, it will make a zipped backup of the items
270 before they are actually deleted.&nbsp; Safedel keeps track of a number
271 that is attached to each zip to enforce uniquely numbered
272 archives.&nbsp; They are stored in a directory named "zz_del_keep"
273 that is stored under the temorary directory (specified by the
274 environment
275 variable named TMP).&nbsp; A report of the contents of the compressed
276 trash
277 is appended to a file named "zz_safedel.rpt" in the TMP directory.&nbsp;
278 Occasional
279 cleaning of the deleted files folder is recommend, but this utility has
280 saved
281 my various parts several times already.</blockquote>
282         <h4> </h4>
283         <h3> </h3>
284         <h3><a href="../archival/snarf_linux_config.pl">snarf_linux_config.pl</a></h3>
285         <blockquote>A snarf utility that packages up the
286 important configuration files in a Linux installation.</blockquote>
287         <h4> </h4>
288         <h3> <a href="../archival/snarf_light.pl">snarf_light.pl</a></h3>
289         <blockquote>A selective snarf of the source hierarchy.&nbsp;
290 This
291 collects the code that I manage.&nbsp; As such, this is probably
292 irrelevant to anyone but CAK.</blockquote>
293         <h3><a href="../archival/snarf_notes.pl">snarf_notes.pl</a></h3>
294         <blockquote>Gathers all "important" files from the home
295 directory.
296 &nbsp;This
297 is somewhat personally tuned but it includes files and directories that
298 have
299 "project", "notes", or "crucial" in their name.</blockquote>
300         <h3> </h3>
301         <h3> <a href="../archival/snarf_src.pl">snarf_src.pl</a></h3>
302         <blockquote>A source code grabbing snarfer.&nbsp; The entire
303 source
304 code hierarchy is snarfed.&nbsp; Note that one should edit the
305 hierarchy
306 location to make it appropriate for your local source code.</blockquote>
307         <h3> </h3>
308         <h3><a href="../archival/snarf_yeti.pl">snarf_yeti.pl</a></h3>
309         <blockquote>A snarfer for the YETI shell scripts and databases.</blockquote>
310         <h3><a href="../files/summing_dir.pl">summing_dir.pl</a></h3>
311         <blockquote>Offers a directory listing along with total file
312 sizes
313 and disk free space.<br>
314           <br>
315         </blockquote>
316         <h3><a href="../build/synch_build.pl">synch_build.pl</a></h3>
317         <blockquote>This is a helper utility that synchronizes the binary
318 outputs from a build process with an existing installed location.&nbsp; Given a target directory, the executable
319 programs and dynamic libraries that exist there will be synchronized
320 with the build repository's versions.&nbsp; This is kind of a quickie
321 upgrade process, as long as the files in the target location are not
322 locked by other processes.<br>
323         </blockquote>
324         <h3> <a href="../archival/unsnarf.pl">unsnarf.pl</a></h3>
325         <blockquote>Uses the snarfer utilities to undo a previously
326 snarfed file.&nbsp; A folder named "snarf_BASE" is created for the
327 contents, where BASE
328 is replaced with the basename of the snarf file (that is, without the
329 ".snarf"
330 suffix).&nbsp; The number that tracks the snarf files of this type is
331 updated
332 such that the next snarf file will be at least one higher than this
333 snarf's
334 sorta
335 unique number.&nbsp; The number will be managed correctly if you're
336 always
337 unsnarfing the most recent snarf files before creating any new snarfs.</blockquote>
338         <h4> </h4>
339         <h3> <a href="../files/whack_forever.pl">whack_forever.pl</a></h3>
340         <blockquote>Since all of my file deletion commands are aliases
341 to <a href="#safedel">safedel</a>, it is hard to actually remove a
342 file. &nbsp;If I'm really really sure that a file or directory needs to
343 be
344 permanently deleted, then this command can be used. &nbsp;It shows the
345 names
346 it is removing also, but it does _not_ ask for confirmation.</blockquote>
347         <h3> </h3>
348         <h3><a href="../security/y2038_check.pl">y2038_check.pl</a></h3>
349         <div style="margin-left: 40px;">Tests the system for survival
350 past the year 2038, which is when the Unix time scale runs out of bits
351 for the number of seconds since 1970 measured in a 32 bit integer.<br>
352         </div>
353         <h3><a href="../files/zapdirs.pl">zapdirs.pl</a></h3>
354         <blockquote>Removes empty directories and directories
355 containing only
356 unimportant crud (see "<a href="#filename%20helper">filename_helper.pl</a>").&nbsp;
357 If there are no arguments, then the current directory is cleaned up;
358 any subdirectories
359 will be traversed into and removed if it seems appropriate.&nbsp;
360 Otherwise,
361 zapdirs operates on the arguments passed to it as if they are directory
362 names
363 to be cleaned.</blockquote>
364       </blockquote>
365       </td>
366     </tr>
367   </tbody>
368 </table>
369 <h3>&nbsp;</h3>
370 </center>
371 </body>
372 </html>