home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
util
/
mayflower.lha
/
MayFlower
/
ByteX
/
ByteX.doc
< prev
next >
Wrap
Text File
|
1994-05-04
|
13KB
|
288 lines
ByteX 5.0 (19940302)
by Stephen D. Childers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--\ /-- *** WARNING !!! *** *** WARNING !!! ***
(o) (o)
^ This program, if not used properly, can damage files. [ouch]
\_____/
Do not use this program on original files unless you know exactly what
you are doing.
This is the warning that should have been given with the first version of
this program.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Program Description:
1) Program is used to alter TEXT or BINARY files.
This program will take an input file and exchange an old word
pattern for a new word pattern. All old word patterns in the file
will be exchanged with the new word pattern. The format for the
old word pattern and new word pattern may be as strings or
hexadecimals.
2) Program will print out the total number of exchanges made.
3) Runs only from CLI. Can be made resident.
4) The [-options] argument can be placed in the 1st, 2nd or 3rd
argument position of the command line; placing the [-options] in
the 2nd argument position will allow this program to be used with
the S:SPAT script file, thus allowing the use of wild characters.
The following examples are for proper SPAT operation:
ie > Execute SPAT Bytex *.c -o -s "DF0:" -s "RAM:"
or > Execute SPAT Bytex in:here/#?.c out:there/ -c -s "DF0:" -s "RAM:"
The following SPAT example will not work as expected:
no > Execute SPAT Bytex -o #?.c -s "DF0:" -s "RAM:"
IMPORTANT NOTE:
The SPAT script file must be modified to receive 7 opts before it
can accept the ByteX command line.
5) Program (when run from CLI) will now interact with the 'c:Why'
command after program failures; this command may provide a more
detailed explanation of why the program failed.
The 'Why' command should be used immediately after a program
failure to extract the last program's result code, because
that result code is changed upon the execution of the next CLI
command.
6) Certain error reports will contain the name of the argument, file,
device, (etc) that is associated with failure when it occurs.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLI usage:
1 > ByteX [!|?] [[-options] input [output] -opt1 word1 -opt2 word2]
options c = Case insensitive exchange
o = Overwrite input file
1 = Algorithm 1 (use maximum memory)
2 = Algorithm 2 (use minimum memory)
q = Quiet; do not print messages
! = Show author info
input = The input file; source
output = The output file; destination
opt1 or opt2; 'h' = word is in HEX format.
's' = word is in STRING format.
word1 = the old word to replace.
word2 = the new word that will replace word1.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
1) The formats for words (word1 & word2) can be mixed. One word
may be in the HEX format and the other in the STRING format.
2) Lengths allowed for argument word1 and word2 are restricted by the
maximum limits imposed by the CLI.
3) When altering TEXT files it does not matter if the length of word1
is not equal to the length of word2, but program will run slower.
4) Certain restrictions must be observed when altering BINARY program
files. When altering binary program files you must insure that the
old word (word1) and the new word (word2) are the same lengths or
else the altered program file will most likely fail to run.
5) Option 'c' is for (c)ase insensitive exchanges. Under this
option the case condition of the new word will be exchanged with
the old word regardless of the case condition of the old word.
6) If the [out] (output file) arg is not given (and option -o is not
selected) then the input file name will be used in creating the
output file name, and that name will have the extension ".BX"
appended to it.
7) Option -o does not require the output file argument, and program
will ignore [out] arg if given.
8) Option -o requires algorithm #1 and will load all of the input
file into memory, and if there is not enough memory the program
will inform you to try again without option -o, thereby allowing
algorithm #2 to be used.
9) Option -o will not overwrite inputfile unless the number of
word pattern exchanges is greater than zero.
10) Options -1 & -2 allows user to choose the Read/Write algorithm that
is needed for your system configuration.
ByteX has 2 algorithms, and will automatically choose the algorithm
that your system will allow, or you can force the algorithm of your
choice. The algorithms are for Read/Write operations and are:
-1 Algorithm #1 is the fast mode and attempts to put all of the
input file into system memory when it is available, thus
allowing faster Read/Write operations when working with files
on any device (ie DF0:), thereby reducing drive clatter and
gronking (alias: wear and tear) on drives.
-2 Algorithm #2 is the slow mode and uses a small amount of system
memory (regardless of inputfile size), this will cause drive
gronking and clatter, unless the input file and output file are
on different drives.
To avoid the posibility of drive clatter when working on files
greater than 10000 bytes then use option -1 which will force ByteX
to fail if it is unable to get the memory needed for fast mode.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLI Examples:
1> ByteX anytext newtext -h 0a -h 0a0d
This example will take the inputfile 'anytext' and exchange all
occurances of the hex value '0a' for the new hex value of '0a0d'.
0a = Line Feed (LF), 0d = Carriage Return (CR).
NOTE: This comes in handy when capturing text files from different
computer BBS services that use different line ending formats. You
can now exchange the CR/LF control character combinations to
whatever CR/LF combination suits your particular need.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
2> ByteX -c dpaint -s df1: -s RAD: ; exchange string with string
ByteX -c dpaint -h 6466313a -s RAD: ; exchange hex with string
ByteX -c dpaint -s df1: -h 52414d3a ; exchange string with hex
ByteX -c dpaint -h 6466313a -h 52414d3a ; exchange hex with hex
All of the lines given in this example will accomplish the same
thing; 'df1:' will be replaced with 'RAD:'.
This example will take file 'dpaint' (Deluxe Paint V2.0) and take
all the occurances of the string 'df1:' and exchange them with the
'ram:' string, and the default output file will named dpaint.BX
NOTE: The reason I altered the dpaint (v2.0) program was because it
would keep me from getting the file input window IF the df1: disk
drive was empty. It may be a nice safety feature but I got tired of
having to insert a diskette into df1: just so I could gain access to
the file input window. I do art work in memory first and then save
it to disk (unless the power goes out <smile>).
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3> ByteX Comm Comm1 -s RAM: -s RAD:
This example will replace the string 'RAM:' with 'RAD:' and
the output file will be named as 'Comm1'.
'Comm' is a public domain communications program.
NOTE: The reason I altered this program was because it would bring
up a little window saying 'wrong diskette' if it could not find the
'RAM:' device available. I would rather use RAD.
Please notice the case differences between this example and example
#2; it is possible for a single program to have a device name in