/* now, we define a file name (and make it public, F7 requires it): */
history = expand('%TMP%\history.shl'); global = global 'history'
'ALIAS LOADHIST=RX call charout , " Loading history..."; drop prevLine.; i = 0; do while lines(history); i = i+1; prevLine.i = linein(history); end; prevLine.0 = i; call stream history, "c", "close"; say " done."'
'ALIAS SAVEHIST=RX call charout , " Saving history..."; "@if exist" history "del /f" history; xx = (prevLine.0)-100; if (xx<1) then xx=1; do i = xx to prevline.0; call lineout history, prevLine.i; end; call stream history, "c", "close" ; say " done."'
/* now we redefine "exit" and lay it on certain keys (UM) */
/* We redefine C-K to a smarter duplication function. */
'DEFINE C-K MC /dup/tab'
/* you can even do complex things: */
'DEFINE ( MC /TEXT ()/cleft'
'DEFINE F8 SHELL RX line = insert(date(),line,currOfs); currOfs = currOfs+length(date())'
'DEFINE S-F7 osn rx if currTab = 0 then currTab = findcontextcompletion(); if currTab \= 0 then do; say; do i = 1 to tree.0; say tree.i; end; call charout, print(); oline=""; parse value SysCurPos() with origRow origCol .; key="tab"; end'
/* (UM) here comes the new RECURSE command; see CommandPak's online help */
'ALIAS recurse=rx rargs = "%*"; if ((rargs="") | left(rargs, 1)="-") then "call xhelp recurse";',
'else do; signal on halt; rcurd = directory(); Call charout ,"Collecting directories... "; call SysFileTree "*", dirs ,"DSO"; Say "Done.";',
'do i_ = 1 to dirs.0; signal on halt; say "["dirs.i_"] >"rargs; call directory dirs.i_; call eval rargs" ^& rx needCR=0"; end; call directory rcurd; end; '
'ALIAS rec=recurse %*'
/* (UM) here comes the new OPEN command; see CommandPak's online help */
'ALIAS open=rx what = "%*"; ocurd = directory(); if (left(what, 1)="-") then "call xhelp open"; else do; if (what = "") then what = ocurd;',
'signal on halt; call eval "cd" what; call charout , "Trying to open "directory()"... "; ',
'if SysSetObjectData(directory(),"OPEN=DEFAULT") then say "OK."; else say "failed."; call directory ocurd; end '
/* (UM) set a RULE: browse through directories only */
'RULE open=%d'
/* netscape is used so that you can simply enter */
/* "netscape index.html" instead of "netscape file:index.html" which */
/* is required by Netscape if you don't want to receive an error */
/* message. If you specify an URL instead of a file name, it still */
/* works, too. */
'ALIAS netscape=rx url=stream("%1", "c", "query exists"); if url="" then call eval("start netscape.exe %1"); else call eval("start netscape.exe" url)'
/* loop allows you to do a command more than once. Please note that */
/* it requires a REXX syntax. For example, */
/* "loop 10; 'mp123 Lillith.mp3'; end" will play the Lillith song ten */
/* times. [Lillith is a track from Plaid's album "Not For Threes", */
/* featuring Björk.] */
'ALIAS loop=rx do %*'
'ALIAS qd=query date'
'ALIAS qt=query time'
/* useful rule... from my point of view :-) */
'RULE WHENCE=%f %e'
'RULE recurse=%x'
/* CONFIG EXTERNAL PROGRAMS */
/* ======================== */
/* (UM) now we set up common stuff for SDir/xdir */
'SET DIRCLR.ATTRIB=D:cyan;S,R,H:on red'
'SET DIRCLR.DATE=-3:on blue'
'SET DIRCLR.EXT=BAT,EXE,COM,CMD:bright red'
'SET DIRCLR.WPABSTRACT=green'
'SET CMDSHL.PROMPT=cmdshl $p$g'
/* (UM) uncomment the following to set xdir's default output to UNIX fmt. */
/* 'SET XDIR.DIRCMD=-C' */
/* (UM) Now configure the help system (xhelp.cmd). See CommandPak's online */
/* help for details on supported environment variables. */
/* Typing 'help cmdshl' or 'help ref' will bring up three books: */
'SET HELP.REF=cmdpak0+mlrxshl+cmdpak'
'SET HELP.CMDSHL=cmdpak0+mlrxshl+cmdpak'
/* Make MLRXSHL's commands support xhelp: */
'SET HELP.COMMAND=xhelp'
'SET HELP.SWITCHES=/? -h --help'
helpSwitches = '/? -h --help'
/* Now make xhelp's output a little more colorful: */
'SET HELP.ANCHOR=on blue'
'SET HELP.BOLD=bright'
'SET HELP.ITALICS=cyan'
/* The following sets the English message file used for xhelp, */
/* in this case XHELP001.MSG: */
'SET HELP.COUNTRY=001'
/* 'SET HELP.COUNTRY=049' would be German (XHELP049.MSG) */
/* (UM) Replace standard commands -- since aliases are case-sensitive, you */
/* can still call OS/2's originals by capitalizing them: */