Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
*************************************************************************
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
1998-09-08 16:53:14 +00:00
|
|
|
* $Id: invoke.asm,v 1.7 1998/09/08 16:53:10 tribby Exp $
|
1998-04-24 15:38:47 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* INVOKE.ASM
|
|
|
|
* By Tim Meekins
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
* Modified by Dave Tribby for GNO 2.0.6
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* Command invocation routines.
|
|
|
|
*
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
* Note: text set up for tabs at col 16, 22, 41, 49, 57, 65
|
|
|
|
* | | | | | |
|
|
|
|
* ^ ^ ^ ^ ^ ^
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Interfaces defined in this file:
|
|
|
|
*
|
|
|
|
* redirect subroutine (4:sfile,4:dfile,4:efile,2:app,2:eapp,2:pipein,
|
|
|
|
* 2:pipeout,2:pipein2,2:pipeout2)
|
|
|
|
* returns with carry set/clear to indicate failure/success
|
|
|
|
*
|
|
|
|
* invoke subroutine (2:argc,4:argv,4:sfile,4:dfile,4:efile,2:app,
|
|
|
|
* 2:eapp,2:bg,4:cmd,2:jobflag,2:pipein,2:pipeout,
|
|
|
|
* 2:pipein2,2:pipeout2,4:pipesem)
|
1998-07-20 16:23:11 +00:00
|
|
|
* return 2:rtnval
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
mcopy /obj/gno/bin/gsh/invoke.mac
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
dummyinvoke start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
setcom 60
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
SIGINT gequ 2
|
|
|
|
SIGKILL gequ 9
|
|
|
|
SIGTERM gequ 15
|
|
|
|
SIGSTOP gequ 17
|
|
|
|
SIGTSTP gequ 18
|
|
|
|
SIGCONT gequ 19
|
|
|
|
SIGCHLD gequ 20
|
|
|
|
SIGTTIN gequ 21
|
|
|
|
SIGTTOU gequ 22
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Redirect
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
redirect START
|
|
|
|
|
|
|
|
space equ 1
|
|
|
|
pipeout2 equ space+3
|
|
|
|
pipein2 equ pipeout2+2
|
|
|
|
pipeout equ pipein2+2
|
|
|
|
pipein equ pipeout+2
|
|
|
|
eapp equ pipein+2
|
|
|
|
app equ eapp+2
|
|
|
|
efile equ app+2
|
|
|
|
dfile equ efile+4
|
|
|
|
sfile equ dfile+4
|
|
|
|
end equ sfile+4
|
|
|
|
|
|
|
|
; subroutine (4:sfile,4:dfile,4:efile,2:app,2:eapp,2:pipein,2:pipeout,2:pipein2,2:pipeout2),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
phd
|
|
|
|
tcd
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Redirect standard input
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
ora2 sfile,sfile+2,@a If no name provided,
|
1998-09-08 16:53:14 +00:00
|
|
|
beq execa skip it.
|
1998-08-03 17:30:30 +00:00
|
|
|
pei (sfile+2) Convert c-string
|
|
|
|
pei (sfile) filename to
|
|
|
|
jsr c2gsstr GS/OS string.
|
|
|
|
sta RedirectFile Store filename pointer
|
|
|
|
stx RedirectFile+2 in parameter block.
|
|
|
|
stz RedirectDev stdin devnum = 0.
|
|
|
|
stz RedirectApp Cannot append.
|
|
|
|
RedirectGS RedirectParm
|
1997-11-18 05:31:00 +00:00
|
|
|
php
|
1998-08-03 17:30:30 +00:00
|
|
|
ph4 RedirectFile Free allocated GS/OS string.
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl nullfree
|
|
|
|
plp
|
1998-08-03 17:30:30 +00:00
|
|
|
bcc execa If RedirectGS failed,
|
|
|
|
ldx #^err1 print error message:
|
|
|
|
lda #err1 'Error redirecting standard input.'
|
|
|
|
jmp badbye and quit.
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Redirect standard output
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
execa ora2 dfile,dfile+2,@a
|
|
|
|
beq execb
|
|
|
|
pei (dfile+2)
|
|
|
|
pei (dfile)
|
1998-08-03 17:30:30 +00:00
|
|
|
jsr c2gsstr
|
1997-11-18 05:31:00 +00:00
|
|
|
sta RedirectFile
|
|
|
|
stx RedirectFile+2
|
1998-08-03 17:30:30 +00:00
|
|
|
ld2 1,RedirectDev stdout devnum = 1
|
1997-11-18 05:31:00 +00:00
|
|
|
mv2 app,RedirectApp
|
1998-08-03 17:30:30 +00:00
|
|
|
RedirectGS RedirectParm
|
1997-11-18 05:31:00 +00:00
|
|
|
php
|
|
|
|
ph4 RedirectFile
|
|
|
|
jsl nullfree
|
|
|
|
plp
|
|
|
|
bcc execb
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
ldx #^err2 Print error message:
|
|
|
|
lda #err2 'Error redirecting standard output.'
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp badbye
|
1998-09-08 16:53:14 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Redirect standard error
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
execb ora2 efile,efile+2,@a
|
|
|
|
beq execc
|
|
|
|
pei (efile+2)
|
|
|
|
pei (efile)
|
1998-08-03 17:30:30 +00:00
|
|
|
jsr c2gsstr
|
1997-11-18 05:31:00 +00:00
|
|
|
sta RedirectFile
|
|
|
|
stx RedirectFile+2
|
|
|
|
ld2 2,RedirectDev
|
|
|
|
mv2 eapp,RedirectApp
|
1998-08-03 17:30:30 +00:00
|
|
|
RedirectGS RedirectParm
|
1997-11-18 05:31:00 +00:00
|
|
|
php
|
|
|
|
ph4 RedirectFile
|
|
|
|
jsl nullfree
|
|
|
|
plp
|
|
|
|
bcc execc
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
ldx #^err3 Print error message:
|
|
|
|
lda #err3 'Error redirecting standard error.'
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp badbye
|
1998-09-08 16:53:14 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Is input piped in?
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
execc lda pipein
|
|
|
|
beq execd
|
1998-09-08 16:53:14 +00:00
|
|
|
dup2 (pipein,#1)
|
1997-11-18 05:31:00 +00:00
|
|
|
mv2 pipein2,CloseRef
|
|
|
|
Close CloseParm
|
|
|
|
ldx #0
|
|
|
|
lda pipein
|
|
|
|
SetInputDevice (#3,@xa)
|
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Is output piped?
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
execd lda pipeout
|
|
|
|
beq exece
|
|
|
|
dup2 (pipeout,#2)
|
|
|
|
mv2 pipeout2,CloseRef
|
|
|
|
Close CloseParm
|
|
|
|
ldx #0
|
|
|
|
lda pipeout
|
|
|
|
SetOutputDevice (#3,@xa)
|
|
|
|
exece anop
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; All the file and pipe redirection has been handled. Time to say goodbye.
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
goodbye ldy #0
|
|
|
|
bra exit
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
badbye jsr errputs
|
1998-09-08 16:53:14 +00:00
|
|
|
cop $7F ; get out of the way
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #1
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
exit lda space
|
|
|
|
sta end-3
|
|
|
|
lda space+1
|
|
|
|
sta end-2
|
|
|
|
pld
|
|
|
|
tsc
|
|
|
|
clc
|
|
|
|
adc #end-4
|
|
|
|
tcs
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
cpy #1 Clear/set carry for success/failure.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
rtl
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; Parameter block for shell call to redirect I/O (ORCA/M manual p.425)
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
RedirectParm dc i2'3' pCount
|
1998-09-08 16:53:14 +00:00
|
|
|
RedirectDev ds 2 Dev num (0=stdin,1=stdout,2=errout)
|
|
|
|
RedirectApp ds 2 Append flag (0=delete)
|
|
|
|
RedirectFile ds 4 File name (GS/OS input string)
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; Parameter block for GS/OS call to close a file
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
CloseParm dc i'1' pCount
|
|
|
|
CloseRef dc i'0' refNum
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
err1 dc c'gsh: Error redirecting standard input.',h'0d00'
|
|
|
|
err2 dc c'gsh: Error redirecting standard output.',h'0d00'
|
|
|
|
err3 dc c'gsh: Error redirecting standard error.',h'0d00'
|
1998-09-08 16:53:14 +00:00
|
|
|
|
|
|
|
END
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Invoke a command (PHASE 0)
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
invoke START
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
using hashdata
|
|
|
|
using vardata
|
|
|
|
using global
|
|
|
|
using pdata
|
|
|
|
|
|
|
|
p equ 0
|
|
|
|
biflag equ p+4
|
|
|
|
ptr equ biflag+2
|
1998-07-20 16:23:11 +00:00
|
|
|
rtnval equ ptr+4 Return pid, -1 (error), or 0 (no fork)
|
|
|
|
dir equ rtnval+2
|
|
|
|
space equ dir+4
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
subroutine (2:argc,4:argv,4:sfile,4:dfile,4:efile,2:app,2:eapp,2:bg,4:cmd,2:jobflag,2:pipein,2:pipeout,2:pipein2,2:pipeout2,4:pipesem),space
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
ld2 -1,rtnval
|
1997-11-18 05:31:00 +00:00
|
|
|
stz biflag ;not a built-in
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
lda argc Get number of arguments.
|
|
|
|
bne chknull If != 0 continue with processing.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
lda sfile If any of the file pointers
|
|
|
|
ora sfile+2 are != NULL,
|
1997-11-18 05:31:00 +00:00
|
|
|
ora dfile
|
|
|
|
ora dfile+2
|
|
|
|
ora efile
|
|
|
|
ora efile+2
|
|
|
|
beq nulldone
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
ldx #^spcmdstr print error message:
|
|
|
|
lda #spcmdstr ' specify a command before redirecting.'
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
nulldone jmp done
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; Check for null command
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
chknull ldy #2 Move command line
|
|
|
|
lda [argv] pointer to
|
|
|
|
sta dir dir (4 bytes).
|
|
|
|
lda [argv],y
|
|
|
|
sta dir+2 If pointer == NULL
|
|
|
|
ora dir
|
|
|
|
beq nulldone all done.
|
|
|
|
lda [dir] If first character == '\0',
|
|
|
|
and #$FF
|
|
|
|
beq nulldone all done.
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; check for file
|
|
|
|
;
|
|
|
|
checkfile anop
|
|
|
|
|
|
|
|
pei (dir+2)
|
|
|
|
pei (dir)
|
|
|
|
jsl IsBuiltin ;check builtin first
|
|
|
|
cmp #-1
|
|
|
|
jne trybuiltin
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
; Command is not listed in the built-in table. See if it was hashed
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
pei (dir+2)
|
|
|
|
pei (dir)
|
|
|
|
ph4 hash_table
|
|
|
|
ph4 #hash_paths
|
|
|
|
jsl search
|
|
|
|
cmp #0
|
|
|
|
bne changeit
|
|
|
|
cpx #0
|
|
|
|
beq skip
|
|
|
|
|
|
|
|
changeit sta dir
|
|
|
|
stx dir+2
|
|
|
|
|
|
|
|
skip lock mutex2
|
|
|
|
pei (dir+2)
|
|
|
|
pei (dir)
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr c2gsstr
|
1998-09-08 16:53:14 +00:00
|
|
|
sta GRecPath
|
|
|
|
sta ptr
|
|
|
|
stx GRecPath+2
|
|
|
|
stx ptr+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
GetFileInfo GRec
|
1997-11-18 05:31:00 +00:00
|
|
|
unlock mutex2
|
1998-09-08 16:53:14 +00:00
|
|
|
jcs notfound
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; File type $B5 is a GS/OS Shell application (EXE)
|
1998-09-08 16:53:14 +00:00
|
|
|
if2 GRecFileType,eq,#$B5,doExec
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
; File type $B3 is a GS/OS application (S16)
|
1998-09-08 16:53:14 +00:00
|
|
|
if2 @a,eq,#$B3,doExec
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx vardirexec
|
|
|
|
bne ft02
|
|
|
|
cmp #$0F
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
jeq doDir Target is a directory; change to it.
|
|
|
|
|
|
|
|
; File type $B0 is a source code file (SRC)
|
1998-09-08 16:53:14 +00:00
|
|
|
ft02 if2 @a,ne,#$B0,badfile
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; Type $B0, Aux $00000006 is a shell command file (EXEC)
|
1998-09-08 16:53:14 +00:00
|
|
|
if2 GRecAuxType,ne,#6,badfile
|
|
|
|
if2 GRecAuxType+2,ne,#0,badfile
|
|
|
|
jmp doShell
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
badfile ldx dir+2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda dir
|
|
|
|
jsr errputs
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
ldx #^err1 Print error message:
|
|
|
|
lda #err1 'Not executable.'
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
|
|
|
free pei (ptr+2)
|
|
|
|
pei (ptr)
|
|
|
|
jsl nullfree
|
1998-09-08 16:53:14 +00:00
|
|
|
jmp done
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; launch an executable
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
doExec pei (ptr+2)
|
|
|
|
pei (ptr)
|
|
|
|
jsl nullfree
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr prefork
|
1998-09-08 16:53:14 +00:00
|
|
|
fork #invoke0
|
|
|
|
jsr postfork
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp done
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
invoke0 phk
|
|
|
|
plb
|
|
|
|
;
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; make a copy of cmd
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
pha
|
|
|
|
pha
|
|
|
|
tsc
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
ldx #0
|
|
|
|
tsc
|
|
|
|
FindHandle @xa,1
|
|
|
|
ldy #6
|
|
|
|
lda [1],y ;This is the UserID!
|
|
|
|
and #$F0FF
|
|
|
|
pha
|
|
|
|
ph4 _cmd
|
|
|
|
jsr cstrlen
|
|
|
|
inc a
|
|
|
|
ply
|
|
|
|
pha
|
|
|
|
ldx #0
|
|
|
|
NewHandle (@xa,@y,#$4018,#0),1
|
|
|
|
ply
|
|
|
|
ldx #0
|
|
|
|
PtrToHand (_cmd,1,@xy)
|
|
|
|
ldy #2
|
|
|
|
lda [1],y
|
|
|
|
tax
|
|
|
|
lda [1]
|
|
|
|
pld
|
|
|
|
ply
|
|
|
|
ply
|
|
|
|
phx ;_cmd
|
|
|
|
pha
|
|
|
|
;
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; make a copy of dir
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
pha
|
|
|
|
pha
|
|
|
|
tsc
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
ldx #0
|
|
|
|
tsc
|
|
|
|
FindHandle @xa,1
|
|
|
|
ldy #6
|
|
|
|
lda [1],y ;This is the UserID!
|
|
|
|
and #$F0FF
|
|
|
|
pha
|
|
|
|
ph4 _dir
|
|
|
|
jsr cstrlen
|
|
|
|
inc a
|
|
|
|
ply
|
|
|
|
pha
|
|
|
|
ldx #0
|
|
|
|
NewHandle (@xa,@y,#$4018,#0),1
|
|
|
|
ply
|
|
|
|
ldx #0
|
|
|
|
PtrToHand (_dir,1,@xy)
|
|
|
|
ldy #2
|
|
|
|
lda [1],y
|
|
|
|
tax
|
|
|
|
lda [1]
|
|
|
|
pld
|
|
|
|
ply
|
|
|
|
ply
|
|
|
|
phx ;_dir
|
|
|
|
pha
|
|
|
|
|
|
|
|
jsl infork
|
|
|
|
bcs invoke1
|
1998-09-08 16:53:14 +00:00
|
|
|
case on
|
|
|
|
jsl _execve For 2.0.6: call _execve, not execve
|
|
|
|
case off
|
1997-11-18 05:31:00 +00:00
|
|
|
rtl
|
|
|
|
invoke1 pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
rtl
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; Next command is a directory name, so change to that directory
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
doDir lock cdmutex
|
|
|
|
mv4 GRecPath,PRecPath
|
|
|
|
SetPrefix PRec
|
1997-11-18 05:31:00 +00:00
|
|
|
unlock cdmutex
|
1998-07-20 16:23:11 +00:00
|
|
|
stz rtnval Return value: no fork done.
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp free
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
; Next command is a shell command file: fork a shell script
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
doShell inc biflag ;don't free argv...
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr prefork
|
|
|
|
|
|
|
|
* int fork2(void *subr, int stack, int prio, char *name, word argc, ...)
|
1998-09-08 16:53:14 +00:00
|
|
|
pea 0
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
pha
|
|
|
|
lda [argv]
|
|
|
|
pha
|
|
|
|
pea 0
|
|
|
|
pea 1024
|
|
|
|
ph4 #exec0
|
1998-09-08 16:53:14 +00:00
|
|
|
case on
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl fork2
|
|
|
|
case off
|
|
|
|
|
|
|
|
* fork #exec0
|
1998-09-08 16:53:14 +00:00
|
|
|
jsr postfork
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp free
|
|
|
|
|
|
|
|
exec0 ph2 _argc ;for argfree
|
|
|
|
ph4 _argv
|
|
|
|
|
|
|
|
ph4 _dir ;for shellexec
|
|
|
|
ph2 _argc
|
|
|
|
ph4 _argv
|
|
|
|
jsl infork
|
|
|
|
bcs exec0c
|
|
|
|
signal (#SIGCHLD,#0)
|
1998-09-08 16:53:14 +00:00
|
|
|
PushVariablesGS NullPB
|
1997-11-18 05:31:00 +00:00
|
|
|
pea 1
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl ShellExec
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl argfree
|
1998-09-08 16:53:14 +00:00
|
|
|
PopVariablesGS NullPB
|
1997-11-18 05:31:00 +00:00
|
|
|
rtl
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
exec0c pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
rtl
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
; Null parameter block used for shell calls PushVariables
|
|
|
|
; (ORCA/M manual p.420) and PopVariablesGS (p. 419)
|
|
|
|
NullPB dc i2'0' pCount
|
|
|
|
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* File name was found in the built-in table
|
|
|
|
|
|
|
|
trybuiltin inc biflag It's a built-in. Which type?
|
1998-09-08 16:53:14 +00:00
|
|
|
cmp #1 Either fork or don't fork.
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
beq noforkbuiltin
|
|
|
|
|
|
|
|
;
|
|
|
|
; It's a forked builtin
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
jsr prefork
|
|
|
|
fork #forkbuiltin
|
1998-09-08 16:53:14 +00:00
|
|
|
jsr postfork
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp done
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
;
|
|
|
|
; Control transfers here for a forked built-in command
|
|
|
|
;
|
|
|
|
forkbuiltin cop $7F Give palloc a chance
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
ph2 _argc
|
|
|
|
ph4 _argv
|
|
|
|
jsl infork
|
|
|
|
bcs fork0c
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl builtin
|
1997-11-18 05:31:00 +00:00
|
|
|
rtl
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
; Error reported by infork; clean up stack and return to caller
|
1997-11-18 05:31:00 +00:00
|
|
|
fork0c pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
rtl
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; It's a non-forked builtin
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
noforkbuiltin anop
|
|
|
|
pei (argc)
|
|
|
|
pei (argv+2)
|
|
|
|
pei (argv)
|
|
|
|
jsl builtin
|
1998-07-20 16:23:11 +00:00
|
|
|
stz rtnval Return value: no fork done.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra done
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
*
|
|
|
|
* ---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Command was not found as built-in or as a file
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
notfound pei (ptr+2)
|
|
|
|
pei (ptr)
|
|
|
|
jsl nullfree
|
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
tax
|
|
|
|
lda [argv]
|
|
|
|
jsr errputs
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
ldx #^err2 Print error message:
|
|
|
|
lda #err2 'Command not found.'
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
lda pipein
|
|
|
|
beq notfound0
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ssignal _semaphore
|
|
|
|
sdelete _semaphore
|
|
|
|
mv4 pjoblist,p
|
|
|
|
ldy #16 ;p_jobid
|
|
|
|
lda [p],y
|
|
|
|
getpgrp @a
|
|
|
|
eor #$FFFF
|
|
|
|
inc a
|
|
|
|
kill (@a,#9)
|
|
|
|
sigpause #0
|
|
|
|
notfound0 anop
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
done cop $7F
|
|
|
|
lda biflag
|
|
|
|
bne skipfrarg
|
|
|
|
|
|
|
|
pei (argc)
|
|
|
|
pei (argv+2)
|
|
|
|
pei (argv)
|
|
|
|
jsl argfree
|
|
|
|
|
|
|
|
skipfrarg pei (cmd+2)
|
|
|
|
pei (cmd)
|
|
|
|
jsl nullfree
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
return 2:rtnval
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
;
|
|
|
|
; stuff to do just before forking
|
|
|
|
;
|
|
|
|
prefork lock mutex
|
|
|
|
SetInGlobals (#$FF,#00)
|
|
|
|
mv4 sfile,_sfile
|
|
|
|
mv4 dfile,_dfile
|
|
|
|
mv4 efile,_efile
|
|
|
|
mv2 app,_app
|
|
|
|
mv2 eapp,_eapp
|
|
|
|
mv4 cmd,_cmd
|
|
|
|
mv4 dir,_dir
|
|
|
|
mv2 argc,_argc
|
|
|
|
mv4 argv,_argv
|
|
|
|
mv2 pipein,_pipein
|
|
|
|
mv2 pipeout,_pipeout
|
|
|
|
mv2 pipein2,_pipein2
|
|
|
|
mv2 pipeout2,_pipeout2
|
|
|
|
mv2 bg,_bg
|
|
|
|
mv2 jobflag,_jobflag
|
|
|
|
lda [pipesem]
|
|
|
|
sta _semaphore
|
|
|
|
lda pipesem
|
|
|
|
sta putsem+1
|
|
|
|
lda pipesem+1
|
|
|
|
sta putsem+2
|
|
|
|
rts
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; stuff to do right after forking
|
|
|
|
;
|
1998-07-20 16:23:11 +00:00
|
|
|
postfork sta rtnval
|
1997-11-18 05:31:00 +00:00
|
|
|
lda pipein
|
|
|
|
beq postfork2
|
1998-09-08 16:53:14 +00:00
|
|
|
sta CloseRef
|
1997-11-18 05:31:00 +00:00
|
|
|
Close CloseParm
|
|
|
|
postfork2 lda pipeout
|
|
|
|
beq postfork3
|
1998-09-08 16:53:14 +00:00
|
|
|
sta CloseRef
|
1997-11-18 05:31:00 +00:00
|
|
|
Close CloseParm
|
1998-07-20 16:23:11 +00:00
|
|
|
postfork3 lda rtnval
|
1997-11-18 05:31:00 +00:00
|
|
|
cmp #-1
|
|
|
|
bne postfork4
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
ldx #^deadstr Print error message:
|
|
|
|
lda #deadstr 'Cannot fork (too many processes?)'
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
|
|
|
unlock mutex
|
|
|
|
jmp done
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
postfork4 ldx jobflag
|
|
|
|
dex
|
|
|
|
beq postfork5
|
|
|
|
pha
|
|
|
|
pei (bg)
|
|
|
|
pei (cmd+2)
|
|
|
|
pei (cmd)
|
|
|
|
lda pipein
|
|
|
|
bne postfork4a
|
|
|
|
jsl palloc
|
|
|
|
bra postfork5
|
|
|
|
postfork4a jsl pallocpipe
|
1998-09-08 16:53:14 +00:00
|
|
|
postfork5 lda >mutex ;DANGER!!!!! Assumes knowledge of
|
|
|
|
beq postfork6 ;lock/unlock structure!!!!!!!!
|
1997-11-18 05:31:00 +00:00
|
|
|
cop $7F
|
1998-09-08 16:53:14 +00:00
|
|
|
bra postfork5
|
1997-11-18 05:31:00 +00:00
|
|
|
postfork6 rts
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; stuff to do in fork
|
|
|
|
;
|
|
|
|
infork phk
|
|
|
|
plb
|
|
|
|
|
|
|
|
lda _jobflag
|
|
|
|
bne invoke0b
|
|
|
|
|
|
|
|
Open ttyopen
|
|
|
|
jcs doneinfork
|
|
|
|
|
|
|
|
lda _pipein
|
|
|
|
bne invoke0a
|
|
|
|
tcnewpgrp ttyref
|
|
|
|
invoke0a settpgrp ttyref
|
1998-09-08 16:53:14 +00:00
|
|
|
lda _bg ;if in background then reset tty to
|
1997-11-18 05:31:00 +00:00
|
|
|
and #$FF
|
1998-09-08 16:53:14 +00:00
|
|
|
beq invoke0b ;to the shell process group
|
1997-11-18 05:31:00 +00:00
|
|
|
tctpgrp (gshtty,gshpid)
|
|
|
|
|
|
|
|
invoke0b ph4 _sfile
|
|
|
|
ph4 _dfile
|
|
|
|
ph4 _efile
|
|
|
|
ph2 _app
|
|
|
|
ph2 _eapp
|
|
|
|
ph2 _pipein
|
|
|
|
ph2 _pipeout
|
|
|
|
ph2 _pipein2
|
|
|
|
ph2 _pipeout2
|
|
|
|
jsl redirect
|
|
|
|
jcs doneinfork
|
|
|
|
|
|
|
|
unlock mutex
|
|
|
|
|
|
|
|
lda _pipein
|
|
|
|
bne invoke0c
|
|
|
|
lda _pipeout
|
|
|
|
beq invoke0d
|
1998-09-08 16:53:14 +00:00
|
|
|
screate #0
|
1997-11-18 05:31:00 +00:00
|
|
|
putsem sta >$FFFFFF
|
|
|
|
swait @a
|
|
|
|
bra invoke0d
|
|
|
|
invoke0c lda _pipeout
|
|
|
|
bne invoke0d
|
|
|
|
waitsemy lda _semaphore
|
|
|
|
bne goodsemy
|
|
|
|
cop $7F
|
|
|
|
bra waitsemy
|
|
|
|
goodsemy ssignal _semaphore
|
|
|
|
sdelete _semaphore
|
|
|
|
|
|
|
|
invoke0d anop
|
|
|
|
|
|
|
|
clc
|
|
|
|
bra indone
|
|
|
|
|
|
|
|
doneinfork unlock mutex
|
|
|
|
sec
|
|
|
|
indone rtl
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
mutex key
|
|
|
|
mutex2 key
|
|
|
|
cdmutex key
|
|
|
|
|
|
|
|
_argc dc i2'0'
|
|
|
|
_argv dc i4'0'
|
|
|
|
_sfile dc i4'0'
|
|
|
|
_dfile dc i4'0'
|
|
|
|
_efile dc i4'0'
|
|
|
|
_app dc i2'0'
|
|
|
|
_eapp dc i2'0'
|
|
|
|
_cmd dc i4'0'
|
|
|
|
_dir dc i4'0'
|
|
|
|
_pipein dc i2'0'
|
|
|
|
_pipeout dc i2'0'
|
|
|
|
_pipein2 dc i2'0'
|
|
|
|
_pipeout2 dc i2'0'
|
|
|
|
_bg dc i2'0'
|
|
|
|
_jobflag dc i2'0'
|
|
|
|
_semaphore dc i2'0'
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
str dc c'[0]',h'0d00'
|
1997-11-18 05:31:00 +00:00
|
|
|
err1 dc c': Not executable.',h'0d00'
|
|
|
|
err2 dc c': Command not found.',h'0d00'
|
1998-09-08 16:53:14 +00:00
|
|
|
spcmdstr dc c'Specify a command before redirecting.',h'0d00'
|
1997-11-18 05:31:00 +00:00
|
|
|
deadstr dc c'Cannot fork (too many processes?)',h'0d00' ;try a spoon
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
; Parameter block for GS/OC call GetFileInfo
|
1998-09-08 16:53:14 +00:00
|
|
|
GRec dc i'4' pCount (# of parameters)
|
|
|
|
GRecPath ds 4 pathname (input; ptr to GS/OS string)
|
|
|
|
ds 2 access (access attributes)
|
|
|
|
GRecFileType ds 2 fileType (file type attribute)
|
|
|
|
GRecAuxType ds 4 auxType (auxiliary type attribute)
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
PRec dc i'2'
|
|
|
|
PRecNum dc i'0'
|
|
|
|
PRecPath ds 4
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
CloseParm dc i2'1'
|
|
|
|
CloseRef dc i2'0'
|
|
|
|
|
|
|
|
Err dc i2'0'
|
|
|
|
|
|
|
|
ttyopen dc i2'2'
|
|
|
|
ttyref dc i2'0'
|
|
|
|
dc i4'ttyname'
|
|
|
|
ttyname gsstr '.tty'
|
|
|
|
|
|
|
|
END
|