home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
txtutl
/
ascutils.arc
/
ASCUTILS.DOC
next >
Wrap
Text File
|
1988-05-25
|
8KB
|
144 lines
DESCRIPTION
ASCII UTILITIES
This is a collection of ten convenient utilities for filtering
of text files. While they are in no way unusual, with the
exception of flags.com, they have in common their use of DOS
standard input and standard output, so command line redirection
can (or must, for disk files) be used. Also, each program's
code is very compact, which facilitates their use with a command
librarian such as XEQ115, which is available on better BBS's.
In addition, commented assembly code listings for each of the
ten files is included in this package. The source code is in no
way remarkable, but it illustrates a number of very basic
assembly language programming techniques and the use of basic
DOS function calls (i.e., int 21h calls). It is my hope that
the examples will prove useful for beginning assembly language
programmers.
The individual programs tend to be self-explanatory, and usually
will output a help message if entered incorrectly or with just a
question mark ('?') as the argument. The programs that require
no command line arguments are:
spctab.com tabspc.com rmext.com
uniq.com trim.com
These utilities perform their functions on the std input stream,
and output the results to std output. This means that if no
redirection is entered on the DOS command line, input will be
taken from the keyboard and output will go to the console. To
take input from a disk file, enter [<fname] for the input file.
To direct output to disk file, enter [>fname] for the output
file. Note that output may be directed to a device (such as PRN
or NUL or even CON, which is the default), so output may be
printed directly or even discarded if desired (the NUL device is
a 'bit bucket').
The programs that do require a command argument (parameter) are:
flags.com cipher.com prefix.com
suffix.com rmcol.com
With the exception of flags.com, the argument(s) must precede
any redirection symbols on the command line. The arguments are
fairly obvious, such as a quoted string for prefix.com or
suffix.com, a starting column and column count for rmcol.com,
and an un-quoted (and case-sensitive) character string (cipher
string) for cipher.com. In the case of flags.com, std input and
std output are not used, and the flags (file attribute flags)
must follow the filename, which may be ambiguous (contain wild
cards).
About the assembly source code -
These files were acquired from various sources without source
listings or copyright notices, so I have taken the liberty of
disassebling, debugging (some had serious problems), and re-
structuring the code as logically as my skill and time
permitted. I have added comments which I hope will be helpful in
general, and you are free to modify and use this code as good
taste and conscience permit. I do not solicit any compensation
for these programs, nor do I encourage others to do so.
Incidentally, I have attempted to make these source files
compatible with both MASM and A86, so you have your choice.
Program Descriptions -
FLAGS This program may be used to set or reset the
attribute flags of files. Usage is: flags [filename]
A H R S where [filename] may contain wildcards (*,?),
and the presence of the letter sets the corresponding
flag (Archive, Hidden, Read-only, and System). Entry
of a file name without flags resets all the
attributes to normal. Omission of a filename or use
of an invalid flag designation results in an error
message.
CIPHER This is the same as the DOS cipher command, and usage
is: cipher [cipher string] [<ifile] [>ofile]. The
input file may be the keyboard, and the output file
the console. De-ciphering is done by the identical
procedure with the same cipher string. This is case
sensitive, so take careful note.
PREFIX This program takes a quoted string (either single or
double quotes may be used, as long as they match, so
the alternate type quote may be used in the string)
and prefixes each line of a text file receive from std
input with it. This is only to be used with ASCII
text files, although line lengths may be up to 255
characters with an 80 character prefix.
SUFFIX This is exactly analogous to PREFIX, except that the
quoted string is appended to the ends of the input
lines.
SPCTAB This converts single or multiple spaces in the input
lines to an appropriate number and positioning of tab
characters (the DOS octal tab is used). Also, trail-
ing spaces and tabs are removed, so that a significant
reduction in file character count may result. Uses
std input and output, ASCII files only. Lines may be
up to 511 characters long.
TABSPC This is the opposite of SPCTAB, except that trailing
white space will not be restored.
RMCOL This will remove a column of 0 to 255 contiguous
characters from a text file. The column count will
reset at a line boundary. However, tabs will be
treated as single characters, and this may produce
unexpected results. Usage is:
rmcol n1{delim}n2 [<ifile] [>[>ofile]]
where n1 is the starting column-1 (0 to 256), n2 is
the number of columns to remove (0 is accepted, and no
columns will be removed), and {delim} is tab(s),
space(s), or a single comma if desired. Careless use
of commas results in errors. Files are std input and
std output.
RMEXT This is a limited utility, intended only to remove the
filename extensions from a serial listing, which must
be trimmed of trailing spaces and spurious characters.
The std input and output streams are use here also.
UNIQ Removes consecutive identical lines from std input and
sends to std output. If duplicate lines are not con-
secutive, a sort utility like the DOS sort command
should be used first to group the lines together.
TRIM This simply removes trailing white space from lines
from std input and writes to std output.
I highly recommend XEQ115.COM as a command librarian for these
types of utilities, as it greatly simplifies file maintenance.
Enjoy. J.C. 05/24/88