Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -0,0 +1 @@
|
|||
? CHR$(4)"CATALOG"
|
||||
|
|
@ -0,0 +1 @@
|
|||
CALL "SYSTEM" USING BY CONTENT "ls"
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{ spawn } = require 'child_process'
|
||||
|
||||
ls = spawn 'ls'
|
||||
|
||||
ls.stdout.on 'data', ( data ) -> console.log "Output: #{ data }"
|
||||
|
||||
ls.stderr.on 'data', ( data ) -> console.error "Error: #{ data }"
|
||||
|
||||
ls.on 'close', -> console.log "'ls' has finished executing."
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols binary
|
||||
|
||||
import java.util.Scanner
|
||||
|
||||
runSample(arg)
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method runSample(arg) private static
|
||||
parse arg command
|
||||
if command = '' then command = 'ls -oa' -- for Windows change to: 'cmd /C dir'
|
||||
do
|
||||
say 'Executing command:' command
|
||||
jprocess = Runtime.getRunTime().exec(command)
|
||||
jscanner = Scanner(jprocess.getInputStream())
|
||||
loop label scanning while jscanner.hasNext()
|
||||
say jscanner.nextLine()
|
||||
end scanning
|
||||
catch ex = IOException
|
||||
ex.printStackTrace()
|
||||
end
|
||||
return
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
; Execute a file - the equivalent of system() in stdio
|
||||
;
|
||||
; On entry, r1=>nul-terminated command string
|
||||
; On exit, VS=Couldn't fork
|
||||
; VC=Forked successfully, r0=return value
|
||||
;
|
||||
.CLIsystem
|
||||
trap 2 ; fork()
|
||||
br CLIchild ; Child process returns here
|
||||
bcc CLIparent ; Parent process returns here
|
||||
mov (sp)+,r1
|
||||
tst (sp)+
|
||||
sev ; Couldn't fork, set V
|
||||
rts pc
|
||||
.CLIparent
|
||||
mov r0,-(sp) ; Save child's PID
|
||||
.CLIwait
|
||||
trap 7 ; wait()
|
||||
cmp r0,(sp)
|
||||
beq CLIfinished
|
||||
cmp r0,#&FFFF
|
||||
bne CLIwait ; Loop until child finished
|
||||
.CLIfinished
|
||||
tst (sp)+ ; Drop child's PID
|
||||
mov r1,r0 ; R0=return value
|
||||
mov (sp)+,r1 ; Restore R1
|
||||
tst (sp)+ ; Drop original R0
|
||||
swab r0 ; Move return value to bottom byte
|
||||
rts pc
|
||||
|
||||
; CLI child process
|
||||
; -----------------
|
||||
.CLIchild
|
||||
clr -(sp) ; end of string array
|
||||
mov r1,-(sp) ; => command string
|
||||
mov #UXsh3,-(sp) ; => "-c"
|
||||
mov #UXsh2,-(sp) ; => "sh"
|
||||
mov #&890B,TRAP_BUF ; exec
|
||||
mov #UXsh1,TRAP_BUF+2 ; => "/bin/sh"
|
||||
mov sp,TRAP_BUF+4 ; => pointers to command strings
|
||||
;mov SV_ENVPTR,TRAP_BUF+6 ; => "PATH=etc"
|
||||
trap 0 ; indir()
|
||||
EQUW TRAP_BUF ; exec(shell, parameters)
|
||||
add #8,sp ; If we get back, we didn't fork, we spawned
|
||||
mov (sp)+,r1 ; So, restore registers
|
||||
clr (sp)+ ; and return exit value in R0
|
||||
rts pc
|
||||
|
||||
.UXsh1 EQUS "/bin/sh",0
|
||||
.UXsh2 EQUS "sh",0
|
||||
.UXsh3 EQUS "-c",0
|
||||
ALIGN
|
||||
|
||||
.TRAP_BUF
|
||||
EQUW 0
|
||||
EQUW 0
|
||||
EQUW 0
|
||||
EQUW 0
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
mov #cmd_ls,r1 ; => "ls" command string
|
||||
jsr pc,CLIsystem
|
||||
...
|
||||
.cmd_ls EQUS "ls",0
|
||||
Loading…
Add table
Add a link
Reference in a new issue