home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
msh21.zip
/
MSHFILES.ZIP
/
MSHART.DOC
< prev
next >
Wrap
Text File
|
1992-08-18
|
17KB
|
288 lines
It's Not Just Another DOS Shell
Michael Durant, NEI-PC
Since I have been looking for "The Perfect DOS Shell", I investigate every new
shell program I can find. They all seemed to have one (or more) severe short
commings to me. Now I have found the answer, Mi-Shell. This really is the
one shell for everyone! "How can that be", you may well ask? Well, the
reason is that Mi-Shell (MSH) is completely configurable (programmable) by the
user. You can get anything you want from Mi-Shell (sung to the tune of
"Alice's Restaurant", sort of). I am going to start off by describing the
system as it "comes from the box" and then discuss the "programmability" of
Mi-Shell.
Mi-Shell comes from OPENetwork for only $49.00, less than the cost of any of
the other comparable shell programs (such as Norton Commander, my previous
favorite). The installation is simple and is done without all of the hidden,
inaccessible system bashing that is so common today. Three simple DOS
commands install the package: make a directory for the package, change to that
directory, run the self-extracting pk-unzip on the distribution diskette. The
package is installed and ready to run! If you want to start the shell on you
own, type 'MSH' from the DOS prompt, or you can edit your AUTOEXEC.BAT to
start it every time you boot your system. It is also advisable to add the MSH
directory to your path, especially if you want to start MSH from some other
directory, and/or use the "magic" function. "magic" is the name given by
OPENetwork (ON) to the function that permits all but an 8k "kernel" of MS to
be swapped out of RAM, freeing it for use by applications it "launches".
MSH comes all set up to run in a default configuration that is a good starting
point for many needs. Much of the default configuration reflects the Norton
Commander's (NC) contribution to the field of shells. There are two
independent windows. Each is controlled independently. There are two file
display modes, like NC, 3 columns of file names or 1 column with size, date &
time information included. Unlike NC, however, the length of each window can
be adjusted from one line to the screen size. Movement within the windows is
similar (but not identical). There is a "menu bar" on the top of the screen
that can be one or two lines, and the DOS prompt is always on the 25th line
(like NC).
All of the capabilities of NC are available (with some minor differences) for
"tagging" files, copying the currently highlighted file's name to the command
line, copying, deleting, moving, etc. But there are many more functions
available with MSH in this mode. In the NC, things typed that are not commands
to NC are placed on the line at the DOS prompt, and "ENTER" will pass that
string to COMMAND.COM normally. MSH has this capability as well as many of the
features of the best "command line editors" for recalling and editing past
commands. This has always been one of my biggest complaints about NC.
Things typed on the command line can also be used by MSH for purposes other
than command execution. For instance, if I type '*.obj', it will appear on
the command line. If I then hit 'ALT-P' the display for the current window
will contain only the files in that directory that match that string as if I
had typed "DIR *.OBJ". Another key would have "tagged" all files with the
"obj" extension for use in "looped" commands (to be discussed later on). In
the default configuration there are 70+ commands like these defined. NC has
only a dozen or so.
So far MSH looks like a nice shell program at a nice price, but so what? Well,
now we come to my favorite part. If you don't like a command, you can change
it, delete it or replace it. You can also add new commands that you define,
and lastly, you can link in whole new functions that you write and compile
(examples for C programmers are included, but the information can be extended
to assembly language at least, and perhaps to other languages by OPENetwork in
the future?).
Now lets begin to look at how MSH works, and how we, the users, can change it
for our needs. The entire system, as it comes "out of the box", is built from
control files that use a simple, but powerful, set of "primitives" to create
the commands that you actually execute. The system is built upon a "stack
oriented" processor that is at the core of Mi Shell. It is very similar to the
"Forth" programming language, and in fact, several of the basic commands like
'dup' (which duplicates the top item of "the stack") and 'swap' (which
exchanges the top two items on "the stack") are identical. A more familiar
example would be the RPN calculators, like the H.P. series, that use a stack.
You enter numbers onto the stack, and "operation keys" like '*' (multiply)
operate on one or more items on the stack. Lets take the multiply example.
First you have to get the two numbers to be multiplied onto the stack. To do
that you type the number (say '123.5'). That is the top of the stack. Now
touch the "enter" key, which is similar to the 'dup' function, and that number
is duplicated in the to two items on the stack. Now enter the next number (say
'20') which will become the top stack item. At this point the stack has two
items, your numbers '123.5' and '20'. If you now press the '*' key, those
two numbers are removed from the stack, multiplied and the result ('2470') is
pushed onto the stack. Now instead of the two original numbers, the stack has
only the single result. If all of this sounds very complicated, don't panic!
It is harder to describe than it is to use.
Another reason to relax is that most of the more common changes are very
straight forward (mostly because OPENetwork did a great job of designing their
default configuration files). Lets look at the first few changes that you will
want to make (these are fully described in the manual). We will modify a file
called CONFIG.MSH. This is the master configuration file.
First, lets change the editor to be called by MSH when you have selected a
file and press the F4 key to edit it. Mi-Shell is initially configured to use
an editor that is included with the package. This is a small, fast editor that
is very usable for small editing jobs (similar to the editor that NC supplies
with their package. There is a line in CONFIG.MSH:
"mwe "editor! | define your editor
The text between the quotes is the name of the editor that MSH supplies, mwe.
Everything after the '|' is a comment. There are lots of comments in the
files that OPENetwork included to help make your job easier.
Lets take a moment to look at this line and what it is doing. The line is
scanned from left to right (just like you read, I hope). The first thing that
MSH finds is a string (everything between the quotes). That is called a token.
Tokens are always pushed onto the stack. So now we have one thing on the
stack, a string token ("mwe "). Now MSH comes to 'editor'. It is not in
quotes, so it is not a string, it is an object. Ending the line is the
exclamation mark, '!'. That is one of the built in 'primitive' commands. It
takes the second token on the stack (the string "mwe ") and stores it in the
object named by the top of the stack (editor). Now 'editor' contains the
string "mwe ", and the stack is empty.
So, to make MSH use the PC-Write Lite editor (from Quicksoft), for example,
change that line to read:
"lite "editor! | define your editor
It is as simple as that. Now 'editor' contains "lite ", and when you press
'F4' to edit files, MSH will use PC-LITE as the editor. Next in line are the
controls for the disk drives that are available for MSH to use. The following
lines in the file show that section of the file as shipped:
|"CD" fixed_drives! | define your fixed drives
"CD" fixed_drives!
|"AB"floppy_drives! | define your floppy drives
"AB"floppy_drives!
You can adjust it for extra drives that you want to be able to use, or you can
lock MSH out of particular drives as you desire. For example, My 'D' drive is
being used by a non-DOS operating system at the moment, so I changed the
fixed_drives line as follows:
"C"fixed_drives!
and so MSH does not know about the D drive and does not get confused by
requests to search all drives for a file, for example. Lastly, lets tell MSH
about some utility programs that I have available. These are lines in the
same file:
false berk!
false delta!
false berk_cpmvrm!
Again we push two items onto the stack and store the second one in the top
one. However, this time we do not have a string as the second item. The
'false' is a primitive that pushes a value that equates to false in tests
(zero for number items and empty string for string items). Now when the store
command (the !) executes, it stores "false" in the indicated locations. There
is also a 'true' primitive for the obvious alternate boolean tests.
Again the MSH manual explains how and why to change these, but it should be
apparent. I have the Berkeley Utilities and delta, so the first two changes
should be obvious. The third line controls the set of functions that MSH uses
for copy, move and delete functions. When it is set to true, MSH uses
versions based on the Berkeley Utilities functions 'cp' 'mv' and 'rm',
otherwise it uses built-in 'copy', 'unlink' and 'rename' functions. I like
BU, so I set this one to true also and end up with:
true berk!
true delta!
true berk_cpmvrm!
That is all that is required for many of the changes you are likely to need to
make, especially in the beginning. As you become used to MSH and its initial
configuration, you will think of things to adjust, change, add or delete.
Lets look at a couple of these more complicated changes.
First, I hate to wait for computers (they are supposed to be instantaneous,
after all), and one of the things that PC-LITE does when starting up is to ask
if a backup file should be created or not. There is a command line switch
that bypasses that prompt and automatically creates the backup and goes
directly to editing (another option does not create the backup before the
editing starts). However, the switch has to come after the name of the file
to be edited, and so I cannot make a change to the editor definition we looked
at above. The change has to be made in a different section of Mi-Shell's
configuration, a different file altogether, as a matter of fact.
Here is the most difficult part of changing the MSH system, finding the correct
file to change, There are 17 '.msh' files supplied with the system. Luckily,
4 have almost all of the code for configuring the system. In all fairness,
after a about thirty minutes "poking around" in these files I had a good idea
where to look for the appropriate code to change.
The four main files are CONFIG.MSH, the master config file already mentioned;
KEYBIND.MSH, which describes the functions assigned to keys; MENU.MSH is for
the menu and its functions; and STDDEFS.MSH, which defines most of the high
level functions used by the other three files. There is also a file,
BERK.MSH, that defines functions using the Berkeley Utilities; DEMO.MSH and
DEMO2.MSH are tutorial/sample files that help to describe the MSH environment
and operation (they can be started from the MSH main menu); HELP.MSH which has
most of the help "stuff"; and EXT.MSH is where the 'extension' based
operations are defined (i.e. if the file extension is '.wks' start '123').
The other are 6 '.MSH' files are for various display/video card combinations,
only one of which will be used in any particular installation, and lastly
there is MANDEL.MSH, which shows off a fractal drawing program that is
distributed (along with a version of the game 'life' that is very nice) with
Mi-Shell.
At any rate, I found the appropriate file (KEYBIND.MSH, which has most of the
key assignment data) and the appropriate line of code:
(editor current.name&exec)F4!
Lets dissect this line. There are three "things" on the line. Everything
between the parentheses is the first "thing". Just as in most languages,
parentheses are used to group items. The next "thing" on the line is 'F4' and
finally the '!'. The first two "things" (or objects) are "pushed" onto the
stack. The exclamation point is the same 'store' command we have already
seen. It saves the 'editor current.name&exec' object (we will talk about what
that is in a bit) in the 'F4' object (i.e. what is "executed" every time the
F4 key is pressed).
So far so good, but what did we store at F4? We stored an object with four
parts: 'editor', 'current.name', '&' and 'exec'. Starting on the left, we
have 'editor'. That is the object that we changed earlier to use the name of
our editor. When it is encountered, the string that we assigned to the object
'editor' ("lite ") is placed on the stack. Next is 'current.name'. This is
one of the MSH defined 'primitives'. It "pushes" the currently highlighted
file name on the current directory panel onto the stack. We next come to the
'&'. This is another MSH command called 'and', 'append' or 'concatenate'. It
takes the top two items from the stack, "sticks them together" and then puts
the result back onto the stack. For example, if we assume that current.name
pushed 'sample.txt', after the '&' the top item on the stack will be 'lite
sample.txt'. Finally we come to 'exec', another MSH primitive. 'exec' sends
the top stack item to DOS to be executed ('lite sample.txt' in this example).
Now that we know what the OPENetwork version of the command does, we can
modify it for our needs. What we want is to add " /e" to the string that is
sent to DOS. All we have to do is include that string and append it to the
string already built using the '&' command just discussed. Our modified
command definition looks like this:
(editor current.name " /e"&&exec)F4!
It could also look like this:
(editor current.name& " /e"&exec)F4!
Both definitions will create the string 'lite sample.txt /e' for 'exec'.
Using the tutorials and these simple changes as examples, it is easy to create
your own definitions. You can assign definitions to all four states of the
function keys, Normal, Shifted, Alt and Ctrl. Also, all four versions of the
PgUp, PgDn, Home, End, arrows, Grey +, -, *. Then there are the Ctrl and Alt
versions of all of the letter and number keys. That is a total of 160 keys
that can have definitions. Less than half of them have been defined in the
default configuration, which leaves a lot of room for your custom definitions!
There are also half a dozen mouse clicks that can be defined, including
support for three button rodents.
Besides the ample documentation and comments supplied with MSH, there is
another tool that they had the good sense to supply. That is an interactive
debugger that you can turn on and off as desired. When it is enabled, each
piece of a command can be stepped through one action at a time. The contents
of the stack are displayed as well as the current object being process,
including a pointer to the next "thing" to be processed. It is shown off well
in the tutorial, and I was able to make use of it in debugging a fairly
complicated command that I was trying to create. A couple of minutes with the
debugger showed me the error the first time through (I had spent about half an
hour before that using trial and error to solve the problem without success).
In relation to the above debugging session, I should also mention another
great feature. Once you have made some changes to one of the configuration
files, you can "re-load" the system to use the new commands without having to
"back-out" of Mi-Shell and then restart it. This is a real time saver when
you are trying to create a new command. The last point to bring up here is
that I have to say that the system is VERY robust. I made some REAL stupid
syntax mistakes while I was trying my hand at writing commands, and I never
once was able to "lock-up" Mi-Shell (I have crashed Norton Commander more than
once, and it is not programmable).
If all of the inherent programmability is not enough for you, there is also
the ability to link in your own function written in C using the sample files
that are supplied as a basis. There is a complete set of example files that
create an example set of additional commands for MSH, including a batch file
that will compile, link, etc, the new system. The sample batch file assumes
the Borland Turbo C compiler, but it took only a few minutes to convert for my
Microsoft C compiler.
I hope that this short introduction has given you a good idea of the power
inherent in this package. If, like me, you have never been satisfied with the
current crop of DOS shell programs, Mi-Shell from OPENetwork may be the one
that you have been waiting for too.