home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
e
/
envtrim.zip
/
ENVTRIM.MAN
< prev
next >
Wrap
Text File
|
1992-08-31
|
2KB
|
62 lines
envtrim
Program to reset PARENT-process MS DOS environment variables
USAGE
envtrim -{l|r}nn var [ -{l|r}nn var ]*
FUNCTION
envtrim trims from the left or right ("l" or "r") to a specified
count of characters ("nn") the value associated with environment
variable "var". One or more environment variables can be truncated in
a single invocation of envtrim. The environment variables in the
PARENT process are modified.
For example, if the following environment variables are set
at the root COMMAND.COM level as
USERNAME=jasmith
STATION=0000c0251af3
then
envtrim -l3 username -r6 station
results in
USERNAME=jas
STATION=251af3
This capability is useful, for example, for truncating full Netware
username strings to 3-character strings used by network-aware programs such
as WordPerfect.
METHOD
envtrim copies the environment block from the parent into local
strings, modifies the strings, and copies the strings back to the
parent's environment.
ERROR CONDITIONS
envtrim reports an error if switch letter is not preceeded by a
'-', if the switch letter is not followed by a number, if an invalid
switch letter is entered, or if the environment variable whose value
is to be trimmed cannot be found in the working environment block.
LANGUAGE AND COMPATIBILITY
envtrim is written in TURBOC for MS DOS computers. It has been
tested on DOS 3.3 and DOS 4.01. Since it does not use DOS calls to
effect the modifications (can't, since DOS provides no mechanism to
modify the parent's environment), envtrim may not be compatible with
future versions of DOS.
AUTHOR
envtrim was written by H. D. Todd, Computing Center, Wesleyan
University, December, 1990, using prototypes written by Douglas Bigelow,
at the same address. envtrim is provided in source form and may be
distributed freely providing author information is retained. The author
would appreciate receiving bug reports and copies of modifications and
improvements (HDTodd@eagle.wesleyan.edu or HDTodd@wesleyan.bitnet).