# HG changeset patch # User boisy # Date 1123501732 0 # Node ID 054c318eda0249c4898bc4f22e6988af2e62eebb # Parent 79edc5d44491762c6bbe4d35c493b491a6b15a6a Added for future incorporation into NitrOS-9 Manual diff -r 79edc5d44491 -r 054c318eda02 docs/shellplus/ShellPlus_2_1.lzh Binary file docs/shellplus/ShellPlus_2_1.lzh has changed diff -r 79edc5d44491 -r 054c318eda02 docs/shellplus/ShellPlus_2_2a.lzh Binary file docs/shellplus/ShellPlus_2_2a.lzh has changed diff -r 79edc5d44491 -r 054c318eda02 docs/shellplus/shellplus.doc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/shellplus/shellplus.doc Mon Aug 08 11:48:52 2005 +0000 @@ -0,0 +1,751 @@ +88/10/12 19:42 Shell+ V2.1 Page 001 + + + + Hacked Shell+ v2.1 Documentation + For L-II CoCo-3 Only + + By: Ron Lammardo + + + + BUG FIXES: + +Will now unload (unlink) the correct name. Previously, if the module name +did not match the command filename you typed, shell would not unload the +module, and it would stick in memory until manually unlinked. This shell +reads in the actual module name and uses it instead of whatever was on +the command line. Example: "/d0/cmds/bob" will work correctly now: the +module name within the "bob" file will be the one to unload. + +To prevent attempted execution of a write-only device as a procedure file, +and to help with use of L-II window startup, this shell checks modes and +attempts write of a null to std out when shell starts up. + +You can redirect >>> to a write-only device. Before this, the shell would +open the path in UPDATE mode. + +The quote bug is fixed. That is, leaving off the second quote mark in lines +like - format /d0 r "Disk - will not crash the shell. + +The EX bug is fixed..if you type 'EX' with no parameters (to kill a shell) +it will not attempt to fork any module or return an error to the parent +process. + +Standard error path is now 'un-redirected ' after using a pipe. + + + + ADDITIONS: + +NOBLOCK +------- + +The shell now runs in what is commonly called 'No Block Mode'. Under previous +versions of shell / shell+ if you had a shell running on , say, T2 and you were +running on Term there was no convenient way to send messages back and forth. If +you did an 'echo whats new >/t2' from the Term it would wait around until +the other shell recieved keyboard input. While it was waiting, Term would be +hung up waiting for the echo command to complete. This problem was caused by +the other shell doing a read call, thereby 'blocking out' any other input. + +This release of Shell+ gets around that problem by putting itself to sleep +while waiting for keyboard input, allowing other input to get through & +display. Once the first key is hit for a line, the shell goes into its regular +read routine until the key is pressed. + +The noblock feature can be turned off by : modpatch /p), others +use it with the IF/THEN/ELSE and GOTO commands to make sophisticated +procedures. I use it a lot for window commands, and program startups. + +For example, I have a script in my cmds dir called "fsm". It opens a VDG +screen on W6, and starts Flight Simulator. When I exit FS, it resets W6 +back to a window type (all done in the background): + + * FSM - Procedure Command File in CMDS that starts FS-II. + xmode /w6 type=1; display c >/w6 + chd /dd/games/fs + (fs <>>>/w6; xmode /w6 type=80)& + + +PROMPTS +------- + +Settable and useful prompts. Ron had a great idea: why not add the device +name you're working from to the prompt ( OS9[T2]: )? Loved it, but everyone +liked different method of presentation. So added user-settable prompt: + + p=prompt The prompt may be up to 21 chars, extra ignored. + A space, return, or semicolon terminates the prompt. + By putting the prompt in quotes, scan will continue + until second quote, return, or 21 chars is reached. + + Options include: + # - show shell's decimal proc id # (00-99). + @ - show device name current std out + $ - show current working directory + ( - show current date + ) - show current time + + More than one #,@,$,(,) is ignored. + + +Examples: Prompt Resulting: + + p=OS9/@: OS9/Term: + p="Hi There!" Hi There! + p=OS.#.@: OS.06.T2: + p=$> /d0> + p=") [@]:" 18:30:14 [Term]: + p= : + + + + +88/10/12 19:42 Shell+ V2.1 Page 003 + + +Default prompt- stored starting from offset $003D in this shell. As it comes, +it's set to 'OS9[@]'. You may set using debug to something else. Terminate +your prompt with a $20 (blank). Offset $0054 is the longest you should go +before you run into the rest of the shell code. The longest settable +prompt will stop at $0051 anyway (21 chars worth). + + +It's easy to start up new shells with custom prompts. Just pass it as param. +To start a shell on say, /W4 with a special prompt, you might type: + + 'shell p=OS9/@? i=/w4& ' ... results in shell on W4 with prompt 'OS9/W4?' + +However, if you wish to use the # process id option as a shell parameter +like the above, then since #!&; etc normally means something special, +you must put the string in quotes, which are ignored by P=. Thus instead: + + 'shell p="Hello.#[@]" i=/w4& ' ... gives prompt of 'Hello.07[W4]' + + +PATH REDIRECTION +---------------- + +z={path} - Same as i=/1 except that the parent process is killed. This would be + used in a shellscipt that does a chd,path=,or variable defining that + you want held over when the shellscript ends. + +r=[redirect chars]{path} - redirects the specified paths to the input path. All + allowable path mnemonics are supported : <, >, >>, + <>, <>>, <>>>, >>> + + + +Examples: + +r=>/w - redirects std out to next available window +r=<>>>/w - redirects std in,std out, std err to next available window +r=-%3 +errchk <%3 +unload %0 +load /dd/asm/obj/%0 + +When this is run, the following output will be executed: + +Program to ASM ? - displays on screen +testprog - user types in +asm #16k testprog L O=/dd/asm/obj/testprog >/dd/output +errchk 65535 it will roll over. + +Examples : + +var.0=1 sets to 1 +inc.0 sets to 00002 +dec.0 sets to 00001 + +var.8=002 sets to 002 +dec.8 sets to 00001 +dec.8 sets to 00000 +dec.8 sets to 65535 + + +PAUSE +----- + +Pause will display a message than wait for key press or mouse click. The +message will be sent from the first non-space to the end of the line. + +Example : pause 'Hit any key when ready' <- displays & waits for key/mouse + + +88/10/12 19:42 Shell+ V2.1 Page 007 + + +WILDCARDS +--------- + +Seemed to be one of the most asked for enhancements , so here they are. +Wildcard expansion is performed AFTER variable expansion but before any other +line checking is done. In order for wildcard expansion to take place the first +character on the line must be a colon (':'), otherwise the line will be +processed as is. This option can be reversed (: will prevent expansion) by: + modpatch +filename - also >>+ and >>>+. Appends output to end of [filename]. + + >-filename - also >>- and >>>-. Overwrites contents of [filename]. + +88/10/12 19:42 Shell+ V2.1 Page 008 + + +IF / THEN / ELSE / ENDIF / FI / CLRIF +------------------------------------- + +Condition testing is supported as follows : + +IF -Y - read one char from std err : y=TRUE, n=FALSE +IF -F - TRUE if file exists and is a file +IF -R - TRUE if file exists and is readable +IF -W - TRUE if file exists and is writable +IF -E - TRUE if file exists in execution directory +IF -D - TRUE if file exists and is a directory + +IF ........ where +IF +####### where is one of the following : + + = - TRUE if left side is equal to right side + < - TRUE if left side is less than right side + > - True if left side is greater than right side + <= or =< - True if left side is less than or equal to right side + >= or => - True if left side is greater than or equal to right side + +Without the + symbol in front,the two sides of the equation are compared +character by character from left to right,with any unused characters being +translated to nulls for comparison. If the + symbol is present, the two sides +of the equation are right justified and zero filled, allowing for accurate +numeric condition testing. If either side of the equation is greater than 80 +characters or the test condition is missing , the command will error. Note that +if error exit is turned off (by the -X command) processing will continue on the +next line as if the IF statement was true. + + Examples: + if a=b false if a=b false + if a<=b true if a<>b true + if hello=HellO true if what=what? false + if what<=what? true if what<>what? true + if 09<010 false if 09>010 true + if +09<010 true if +09>010 false + +If a condition is true, following lines will be processed until an optional +ELSE is encountered. Lines will be skipped until a ENDIF or FI is encountered. + +If a condition is false, following lines will be skipped until an ELSE , ENDIF +or FI is encountered. + +The reserved word CLRIF can be used to clear any IF in effect, even if lines +are to be skipped because of a false condition or between ELSE/ENDIF for a +true condition. + +If the input line echo option is on ('T'), the word TRUE or FALSE will be +printing following the if statement depending on how the statement evaluates. + +The condition being tested may be placed in brackets (e.g. - if [ -y ] ) to +maintain compatability with existing IF utilities. + +IF statements can be nested up to 255 deep. The word THEN is optional and will +be ignored if present. + + + + +88/10/12 19:42 Shell+ V2.1 Page 009 + + +GOTO +---- + +Goto [label] - searches for label from the beginning of the file. +Goto [+label] - searches for label from current file position on. + +Label must be an alphanumeric word (up to 40 characters) and must immediatly +follow a '*' comment marker. Label must exactly match the label on the goto +line (upper & lower case are unique). + +If a line contains '*\' as the first two characters, any goto in effect will +be cancelled with processing continuing on the line following. + + +ONERR GOTO +---------- + +Onerr goto [label] +Onerr goto [+label] + +Same as GOTO except that it does not execute until a command errors. After the +error, the GOTO command specified is performed. Note that while executing a +GOTO, the error variable ('%*') is not updated, allowing for error +identification at the goto label. + +Entering ONERR alone on a line causes the on error trap to be cancelled. + +As with the goto command, '*\' causes the goto to be cancelled. + +Example: + +onerr goto lab1 +dir sd <---- errors with #216 +pmap <---- not executed +mmap <---- not executed +*lab1 <---- label matched +if %*=216 <----- expands to 'if 216=216' which evaluates true +goto lab2 <----- jumps to label lab2 +else <----- ignored because condition was true +echo ERROR <----- " " +endif <----- tells shell o.k. to process lines again +smap <----- ignored cause we're going to lab2 +*lab2 <----- found +..... <----- processing continues here + + + + +PATH= +----- + +Path= allows you to specify alternate directorys to search for commands. If the +current execution directory does not contain the desired module, the alternate +paths will be searched in the order specified. This is especially useful for +floppy disk users with limited space, as it allows you to have your CMDS +directory spread across 2 or more disks. The specified paths are retained when +subshells are forked, either by directly calling the shell (shell i=/w&) or by +running a shellscript/memscript. + + +88/10/12 19:42 Shell+ V2.1 Page 010 + + +Pathlists must be separated by spaces only. To clear alternate paths, type +'path=' with no parameters. + +To display the currently assigned paths, use 'path=?' . + +Example: + +path=/d1/cmds /d2/cmds /d2/newcmds + +path=? <** produces +/d1/cmds +/d2/cmds +/d2/newcmds + + +SECURITY +-------- + +If the userid is not 0, any '@' characters will be stripped out to prevent +os9 security being overriden by being able to dump a disk. The potential +problem with prompt setting (@=device name) is taken care of by allowing an +[alt]@ to be accepted in addition to '@'. + +If this feature is undesirable, it can be removed by +'modpatch and start at the correct locations (10 variables of 81 + bytes each). The shellsub must also end with an rts to return control + back to the shell. The shellsub is therefore also responsible for + ensuring that the stack points to the same place at exit as it did upon + entrance. The shell has about 750 bytes available for stack use. All + registers used by the shell are saved before calling the shellsub & + restored after the shellsub returns. + +88/10/12 19:42 Shell+ V2.1 Page 011 + + +USER STARTUP FILE EXECUTION +--------------------------- + +The reserved word 'S.T.A.R.T.U.P' will cause the shell to attempt running a +file called 'startup' in the CURRENT directory. This is very useful when +running Tsmon/Login and you are changing the users working directory. If the +users directory is changed and then the program forked is 'shell s.t.a.r.t.u.p' +the shell will try to run a startup file in the new directory and then remain +active. If no startup file is present, no error is returned. + + +MISC +---- + +A command called PROMPT is included in this archive. It functions the same as +the ECHO command except that it does not do a linefeed after displaying the +line. See the example script under SHELL VARIABLES. + +Also included in the archive is a shellscript called SHELLSCRIPT. This is what +I use to assemble the various versions of Shell+. It is included as an example +of variables,goto and if/then/else use. It is NOT needed to install or use +Shell+. + +You may modify the priority of commands using the "^" (up carat) symbol. +Example: list file >/p ^100 & + +Since all the coding for PWD/PXD is part of the shell for the $ option on +prompt setting, the commands .PWD and .PXD are included with the shell. Once +you do a .PWD or .PXD the directory will be kept in a buffer so that next time +you execute the command it won't have to check the disk. It will also stay in +the buffer if the $ option is used in the prompt. Note that if a pathlist is +over 129 chars long, it will be printed prefixed with an '*', indicating that +the beginning of the pathlist has not been printed. This also applies when +using the working directory as part of the shell prompt. Note : Even if you +use the .PWD/.PXD functions you should keep those commands in your execution +directory, as other programs (notably basic09 routines) may use the shell to +get the current directorys. It is for this reason that the commands are +prefixed with a '.' . + +CD and CX are also allowed for CHD and CHX for Nuxi people. Also '|' allowed +along with '!' as pipe character. + +Echoed input lines ('T' option) will now display the full input line. Why +print only 80 chars if the input buffer is 200 ? + +All modules are now forked with a minimum of 7936 bytes (8k - 1 page) to +handle the greatly expanded parameter line size. If the module needs > 8k or +a memory modifier > 8k (#16k) is specified, that size will be used. + + +If you find any bugs, please let Ron Lammardo (75706,336) know through the CIS +OS9 forum, so that we can take care of them. Suggestions, bitches and kudos +appreciated also. + + + + + + + +88/10/12 19:42 Shell+ V2.1 Page 012 + + +Some of the enhancements in Shell+ came either directly from or were derived +from existing utilities. The ones I can remember are : + +Goto - Kevin Darling +Z= - from GPERE by Kent Meyers +Wildcards - Simmule Turner +NOBLOCK - Kent Meyers +Logging - Karl Krieder + +Shell+ Release 1.0 by Kent Meyers +Shell+ Release 1.1 by Kent Meyers,Kevin Darling,Ron Lammardo + + +V2.0 additions/changes +----------------------- + +- Current date/time displayed when shell starts + +- Current date / time can be used as all or part of the shell prompt. + +- Standard error redirection return fixed for pipes / EX bug fixed + +- Memory scripts + +- Shell Variables (VAR.# , %# , %*, VAR.? , V , -V ) / INC. / DEC. + +- PATH= command (PATH=?) / PAUSE command + +- IF / THEN / ELSE / ENDIF / FI / CLRIF + +- GOTO / ONERR GOTO / *\ + +- Wildcarding + +- Path redirection (Z= , R=) + +- @ removal for users other than user 0 / Logging (L / -L) + +- Shell Subs (%%#) + +- User Startup execution + + +V2.1 additions/changes +----------------------- + +- Wildcard Quoting ('\' as escape character) + +- Wildcarding rewritten (fix comment line errors,upper/lower match,range) + +- Packed BASIC09 memory size error fixed + +- Large parameter line into shell fixed + + diff -r 79edc5d44491 -r 054c318eda02 docs/shellplus/shellplus2.2a.doc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/shellplus/shellplus2.2a.doc Mon Aug 08 11:48:52 2005 +0000 @@ -0,0 +1,92 @@ + This archive should contain: +SCF.IPC ----------->Patchfile to create new SCF with Kevin Darling's keyboard + editing, Bill Nobel's buffer pre-fill call, and some + general optomizations by yours truly +SHELL ------------->Version 2.2a of Shellplus with command history (shell is + so different in it's current state than the Tandy/ + Microware original, I see no sense in making it an IPC + file... someone correct me if I am wrong) +SHELLPLUS2.2A.DOCS->This documentation file + + NOTE: YOU HAVE TO USE THE IPATCH UTILITY TO MAKE A NEW SCF FOR THIS VERSION +OF SHELLPLUS TO WORK. IT REQUIRES THE STOCK SCF AND THE IPATCH UTILILITY, +AVAILABLE ELSEWHERE. + +Ident of original SCF to patch: + +Header for: SCF +Module size: $05E3 #1507 +Module CRC: $F946CA (Good) +Hdr parity: $0E +Edition: $0D #13 +Ty/La At/Rv: $D1 $81 +File Man mod, 6809 obj, re-en, R/O + +Ident of new SCF you should end up with: + +Header for: SCF +Module size: $06E5 #1765 +Module CRC: $E551FB (Good) +Hdr parity: $0B +Edition: $11 #17 +Ty/La At/Rv: $D1 $81 +File Man mod, 6809 obj, re-en, R/O + + In 1992 or 1993, a version of ShellPlus (V2.2) had a limited release that +contained command history (being able to scroll forwards or backwards through +that last few lines that have been typed in the shell. It used Bill Nobel's +modified SCF (which includes Kevin Darling's line editing patches as well) & +worked by temporarily modifying the ABORT & INTERRUPT keyboard signals to be +up & down arrows. (It then used the signals generated by the 2 arrow keys to +go forward or backwards through the command history buffer, even if you were +in the middle of typing a line.) Once you hit , it switched the signals +back to normal, and then processed the line (thus, if you were running a +program, you could still - or out of it). One small problem it +had, though, was that if you DID break out of a program, when it came back to +the shell it still had the - or sitting in the keyboard buffer. +Since the first thing ShellPlus V2.2 did was reset those keys, the real +- / sitting in the buffer got printed as an illegal OS-9 +character ('.'), so you always had a period sitting as the first character on +your new shell prompt line. + I went in and attempted to fix this just after I got this version of +ShellPlus, and did so with partial success. I eliminated the period, but +caused a new bug that if you forking sub-shells and using -/ at 2 +or more levels down a Fork chain (ex. doing a '$dir' from BASIC09 ends up +being 2 levels deep), it crashed all shells running on the machine. So, this +version wasn't released. + Just recently I finally figured out how to fix it, and did. To +differentiate between the two versions, mine is called ShellPlus V2.2a. + While it could have been done without it, this version requires a new SCF, +that has an extra option added onto Bill Nobel's keyboard buffer filling +SetStat call. If the high bit of Y is set, a carriage return will NOT be +appended automatically to the keyboard buffer. This SCF also contains some +minor speed optomizations in other parts of the code as well, so even if you +don't use Shell+, it should be worth your while. + NOTE!!!!! + There was a small bug in the original buffer filling call- it didn't bother +to check the size of the buffer you specified in Y before it tried to copy +it... a large value would crash the machine. Since Shell+ V2.2A REQUIRES the +new high-bit Y version of SCF's buffer filling call, it will CRASH an old SCF +machine as soon as you try to abort (with -, - or ) +any program you run from the shell. MAKE SURE YOU INSTALL THE NEW SCF BEFORE +INSTALLING SHELLPLUS V2.2A! + Shell+ V2.2A also fixes some bugs in Shell+2.1/2.2: +1) It opens Directories (for CHD/CHX/CD/CX) in READ mode instead of UPDATE +(according to the manual, these will be slightly faster) since none of those +shell commands write to the directories. +2) The ^ option (for setting priority just for the command line you are +typing) now works. The original should have worked, but for some reason +didn't. I think it had something to do with trying to change the priority of +a module just after it was forked; maybe it hadn't been 'fully' forked by the +time the priority was to change. I modified Shell+ to set itself to the new +priority, fork the process, and then immediately set itself back to normal. +3) If a ShellSub module was linked (see ShellPlus V2.1 docs), it didn't +unlink it properly, due to to statements being backwards in the original +source. This has now been fixed. + + For those of you running NitrOS9, the new version 1.20 upgrade will include +this shell, and has an even more extensively optomized SCF (see NitrOS9 docs +for details) + + -L. Curtis Boyle, Aug. 20, 1994- +