Annotation of coherent/f/usr/lib/shell.cmd, revision 1.1.1.1

1.1       root        1: ;      Shell.cmd:      MSDOS shell within MicroEMACS
                      2: ;                      written 1987 by Daniel Lawrence
                      3: 
                      4:        write-message "[Setting up SHELL window]"
                      5: 
                      6: store-procedure        getdir
                      7:        shell-command "cd > eshell"
                      8:        set %shtmp $cbufname
                      9:        !force delete-buffer eshell
                     10:        find-file eshell
                     11:        beginning-of-file
                     12:        set %shdir $line
                     13:        select-buffer %shtmp
                     14:        delete-buffer eshell
                     15: !endm
                     16: 
                     17: store-procedure prompt
                     18:        !if &not &equ $curcol 0
                     19:                newline
                     20:        !endif
                     21:        !if &not &seq $line ""
                     22:                open-line
                     23:        !endif
                     24:        insert-string &cat %shdir ">"
                     25: !endm
                     26: 
                     27: store-procedure getline
                     28:        beginning-of-line
                     29:        set %shtmp $curline
                     30:        !force search-forward ">"
                     31:        !if &not &equ $curline %shtmp
                     32:                set $curline %shtmp
                     33:        !endif
                     34:        !if &equ $curchar 10
                     35:                set %shline ""
                     36:        !else
                     37:                kill-to-end-of-line
                     38:                yank
                     39:                set %shline $kill
                     40:        !endif
                     41:        newline
                     42: !endm
                     43: 
                     44: store-procedure execline
                     45:        shell-command &cat %shline " > shtmp"
                     46:        !force insert-file shtmp
                     47: !endm
                     48: 
                     49: ;      prompt and execute a command
                     50: 
                     51: 4      store-macro
                     52:        run getline
                     53:        !if &not &seq %shline ""
                     54:                !if &or &seq &left %shline 2 "cd" &seq &right %shline 1 ":"
                     55:                        shell-command %shline
                     56:                        run getdir
                     57:                !else
                     58:                        run execline
                     59:                !endif
                     60:        !endif
                     61:        run prompt
                     62: !endm
                     63: 
                     64: store-procedure checkmode
                     65:        !if &and %shmode &not &seq $cbufname "[I-SHELL]"
                     66:                set $discmd FALSE
                     67:                bind-to-key newline ^M
                     68:                add-mode blue
                     69:                add-mode WHITE
                     70:                write-message "[Exiting Shell window]"
                     71:                set %shmode FALSE
                     72:                set $discmd TRUE
                     73:        !endif
                     74:        !if &and &not %shmode &seq $cbufname "[I-SHELL]"
                     75:                set $discmd FALSE
                     76:                write-message "[Entering Shell window]"
                     77:                bind-to-key execute-macro-4 ^M
                     78:                run getdir
                     79:                add-mode black
                     80:                add-mode GREEN
                     81:                end-of-file
                     82:                run prompt
                     83:                set %shmode TRUE
                     84:                set $discmd TRUE
                     85:        !endif
                     86: !endm
                     87: 
                     88: ;      window movement (and deactivate us)
                     89: 
                     90: 5      store-macro
                     91:        next-window
                     92:        run checkmode
                     93: !endm
                     94: 
                     95: 6      store-macro
                     96:        previous-window
                     97:        run checkmode
                     98: !endm
                     99: 
                    100: 7      store-macro
                    101:        delete-window
                    102:        run checkmode
                    103: !endm
                    104: 
                    105: 8      store-macro
                    106:        find-file @"Find file:"
                    107:        run checkmode
                    108: !endm
                    109: 
                    110: 9      store-macro
                    111:        next-buffer
                    112:        run checkmode
                    113: !endm
                    114: 
                    115: store-procedure openshell
                    116:        set $discmd FALSE
                    117:        bind-to-key execute-macro-5 ^XO
                    118:        bind-to-key execute-macro-6 ^XP
                    119:        bind-to-key execute-macro-7 ^X0
                    120:        bind-to-key execute-macro-8 ^X^F
                    121:        bind-to-key execute-macro-9 ^XX
                    122:        select-buffer "[I-SHELL]"
                    123:        run checkmode
                    124:        set $discmd TRUE
                    125: !endm
                    126: 
                    127:        set %shmode FALSE
                    128:        run openshell

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.