/***************************************************************************/
/*									   */
/*				Itzz					   */
/*									   */
/***************************************************************************/
/*									   */
/*		* * * * * * * F O R * * * * * * *			   */
/*									   */
/***************************************************************************/

'for' is intendend to give wildcards to programs like MuchMore which do not
support wildcards by themself. Its command template is

for FILE,CMD,EXEC/S,ALL/S

FILE 	is a filename expression, usually with wildcards. default #?
CMD 	is a command string like "MuchMore %s" (notice the quotes !). It
	supports some printf-like expressions.
	%f  the complete filename including the path
	%s  the complete filename without path
	%p  the path of the argument file, without a trailing / or : !!!
	%b  the basename of the file, this is the filename upto the first '.'.
	the default is "%f"
EXEC	the execute flag, if not given, for will only display the commands,
	but not execute them.
ALL     the all flag, directories will be entered (MatchFirst/MatchNext feature!)


Examples:

for *.c "Muchmore %s" exec	 displays all C-sources in your current directory
for *.gif "wasp %s %b.iff" exec  will convert all gifs to iff.
for *.c "rename %s %b.d" exec    renames all *.c to *.d (very handy)
for *.o "%b/%s"			 lists all your object files. (notice the
				 missing 'exec' !

WShell users can get similar effects with
'List *.c quick lformat "MuchMore %s" | stdin',
but 'for' is more flexible with basenames and extensions.

'for' is very tiny and uses no global variables, so it can (and should) be
made resident (even WShell does not complain about it !!). It is very handy
with aliases and 'inline' ARexx scripts.


Example:

alias More for [] "Muchmore %f" exec		or for WShell
alias More LITERAL for [] "MuchMore /%f" exec


Caution:
To keep the program small, I've omitted most error and security checks. The
buffer for filenames and commands is 255 bytes long, which should be enough
for most applications, but commands like

cd LONG_NAME_FOR_DEVICE:A_COUPLE_OF_LONG_PATHNAMES/ANOTHER_LONG_PATH/DITO
for #? "echo %p %p %p %p %p %p %p %f" 

will get the guru for certain, so watch out !!


/***************************************************************************/
/*									   */
/* FOR was written, conceived and compiled by				   */
/*									   */
/*	Michael Illgner 						   */
/*	Theodorstr. 27  						   */
/*	W-4790 Paderborn						   */
/*	Germany 							   */
/*	Tel.: 05251/26488 or 05251/60-2331				   */
/*									   */
/*	email: fillg1@uni-paderborn.de  				   */
/*									   */
/***************************************************************************/

History (short!)

V1.0 Initial release

V1.1 %f implemented

V1.2 AnchorPath must be longword aligned. Thanks to Michael Janich for
     discovering this bug and to Matthias Scheler for explaining it.
     WShell seems to load always at longword boundaries, because I never
     got an error.

V1.3 Added quotes around "%f" filenames, so Filenames including spaces are
     allowed. Which guy called the RamDisk "Ram Disk:" :-(

V1.4 Added break by CNTRL_C

V1.5 Small bug corrected, ArgArray[] must be initialized to NULL. Thanks to
     Michael Janich and Matthias Scheler again for discovering it.

V1.6 Added ALL option for recursive scanning of directory.


ForAll is a similar command, but it will search a directory and all of its
subdirectories for files matching a given pattern. Its command template is

ForAll DIR,PAT,CMD,EXEC/S

DIR	a string specifying the starting directory
PAT	the filepattern to match for
CMD	the command to execute with a matching file
EXEC	the Execute flag, see above for details


Example :

ForAll DH0: *! delete exec 	deletes all emacs-backup files on DH0:
ForAll "" *.c type exec		types all C-Sources in current directory

History (short!)

V1.0 Initial release

