1997-11-18 05:31:00 +00:00
|
|
|
************************************************************************
|
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
* $Id: builtin.asm,v 1.9 1998/12/31 18:29:11 tribby Exp $
|
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
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* BUILTIN.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
|
|
|
*
|
|
|
|
* Builtin command searching and execution.
|
|
|
|
*
|
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
|
|
|
|
* | | | | | |
|
|
|
|
* ^ ^ ^ ^ ^ ^
|
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
|
|
|
*
|
|
|
|
* Interfaces defined in this file:
|
|
|
|
*
|
|
|
|
* builtin subroutine (2:argc,4:argv)
|
|
|
|
* Returns completion status in Accumulator
|
1998-09-08 16:53:14 +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
|
|
|
* IsBuiltin subroutine (4:name)
|
|
|
|
* return 2:tbl
|
|
|
|
*
|
|
|
|
* Remainder are interfaces to builtin commands with interface
|
1998-09-08 16:53:14 +00:00
|
|
|
* subroutine (4:argv,2:argc)
|
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
|
|
|
* returns status in accumulator
|
|
|
|
* cd (chdir is entry as an alternate name)
|
|
|
|
* clear
|
|
|
|
* echo
|
|
|
|
* pwd
|
|
|
|
* which
|
|
|
|
* prefix
|
|
|
|
* rehash (unhash is entry as an alternate name)
|
|
|
|
* exit
|
|
|
|
* setdebug
|
|
|
|
* psbi (command name is "ps")
|
|
|
|
* hashbi (command name is "hash")
|
|
|
|
* source
|
|
|
|
* cmdbi (command name is "commands")
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
mcopy /obj/gno/bin/gsh/builtin.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
|
|
|
dummybuiltin start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
setcom 60
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
p_next gequ 0 ;next in global proclist
|
|
|
|
p_friends gequ p_next+4 ;next in job list
|
|
|
|
p_flags gequ p_friends+4 ;various job status flags
|
|
|
|
p_reason gequ p_flags+2 ;reason for entering this state
|
|
|
|
p_index gequ p_reason+2 ;job index
|
|
|
|
p_pid gequ p_index+2 ;process id
|
|
|
|
p_jobid gequ p_pid+2 ;process id of job leader
|
|
|
|
p_command gequ p_jobid+2 ;command (how job invoked)
|
|
|
|
p_space gequ p_command+4 ;space for structure
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
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
|
|
|
* Find and execute a builtin command
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
builtin START
|
|
|
|
|
|
|
|
using BuiltinData
|
|
|
|
|
|
|
|
val equ 1
|
|
|
|
file equ val+2
|
|
|
|
tbl equ file+4
|
|
|
|
space equ tbl+4
|
|
|
|
argv equ space+3
|
|
|
|
argc equ argv+4
|
|
|
|
end equ argc+2
|
|
|
|
|
|
|
|
; subroutine (2:argc,4:argv),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
sec
|
|
|
|
sbc #space-1
|
|
|
|
tcs
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
|
|
|
|
ldy #2
|
|
|
|
lda [argv]
|
|
|
|
sta file
|
|
|
|
lda [argv],y
|
|
|
|
sta file+2
|
|
|
|
ld4 builtintbl,tbl
|
|
|
|
ld2 -1,val
|
|
|
|
lda argc
|
1998-08-03 17:30:30 +00:00
|
|
|
beq done
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
loop ldy #2
|
|
|
|
lda [tbl]
|
|
|
|
ora [tbl],y
|
|
|
|
beq done
|
|
|
|
lda [tbl],y
|
|
|
|
pha
|
|
|
|
lda [tbl]
|
|
|
|
pha
|
|
|
|
pei (file+2)
|
|
|
|
pei (file)
|
|
|
|
jsr cmpcstr
|
|
|
|
beq foundit
|
|
|
|
bpl done
|
|
|
|
add2 tbl,#10,tbl
|
|
|
|
bra loop
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
;
|
|
|
|
; Found the command handler address. Since we don't have a "jsl [tbl],y"
|
|
|
|
; instruction, after pushing parameters on the stack we will push the
|
|
|
|
; return address, then the command's address - 1 (2 bytes only, since it's
|
|
|
|
; in the current bank). An rts will take us to the command handler, and a
|
|
|
|
; rtl at the end of the handler will bring us back.
|
|
|
|
;
|
|
|
|
foundit anop
|
|
|
|
pei (argv+2) Push parameters (3 words)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (argv)
|
|
|
|
pei (argc)
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
phk Push return address (high byte)
|
|
|
|
per return-1 Push return address (low bytes)
|
|
|
|
ldy #4 Get address of builtin handler
|
|
|
|
lda [tbl],y (16 bytes; assume in this bank)
|
|
|
|
dec a subtract 1 so rts will take us there
|
|
|
|
pha
|
|
|
|
rts Go to builtin handler routine.
|
|
|
|
;
|
|
|
|
; Return from handler to this location
|
|
|
|
;
|
|
|
|
return sta val Save return status.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
;
|
|
|
|
; Free the argv array
|
|
|
|
;
|
1998-12-21 23:57:08 +00:00
|
|
|
ph4 #0 (no path)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (argc)
|
|
|
|
pei (argv+2)
|
|
|
|
pei (argv)
|
|
|
|
jsl argfree
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
done ldy val Y-reg = return value.
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
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
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
tya Accumulator = return value.
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
rtl
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Is it a built-in?
|
|
|
|
*
|
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
|
|
|
* Return value is: -1 if not a built-in, 0 if forked built-in,
|
|
|
|
* 1 if non-forked built-in.
|
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
IsBuiltin START
|
|
|
|
|
|
|
|
using BuiltinData
|
|
|
|
|
|
|
|
tbl equ 0
|
|
|
|
space equ tbl+4
|
|
|
|
|
|
|
|
subroutine (4:name),space
|
|
|
|
|
|
|
|
ld4 builtintbl,tbl
|
1998-09-08 16:53:14 +00:00
|
|
|
builtinloop ldy #2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [tbl]
|
|
|
|
ora [tbl],y
|
|
|
|
beq nofile
|
|
|
|
lda [tbl],y
|
|
|
|
pha
|
|
|
|
lda [tbl]
|
|
|
|
pha
|
|
|
|
pei (name+2)
|
|
|
|
pei (name)
|
|
|
|
jsr cmpcstr
|
|
|
|
beq foundit
|
|
|
|
bpl nofile
|
|
|
|
add2 tbl,#10,tbl
|
|
|
|
bra builtinloop
|
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
|
|
|
foundit ldy #8 Get the fork/nofork flag
|
|
|
|
lda [tbl],y and use it as return value.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra foundbuiltin
|
|
|
|
|
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
|
|
|
nofile lda #-1 Set not-found return value.
|
1998-09-08 16:53:14 +00:00
|
|
|
foundbuiltin sta tbl
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
return 2:tbl
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Builtin data
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
BuiltinData DATA
|
|
|
|
;
|
|
|
|
; First address is a pointer to the name, the second is a pointer to the
|
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. Third value is fork flag (0 to fork, 1 for no fork).
|
|
|
|
; TABLE MUST BE SORTED BY COMMAND NAME.
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
builtintbl dc a4'aliasname,alias',i2'0'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'bgname,bg',i2'1'
|
|
|
|
dc a4'bindkeyname,bindkey',i2'0'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'cdname,cd',i2'1'
|
|
|
|
dc a4'chdirname,chdir',i2'1'
|
|
|
|
dc a4'clearname,clear',i2'1' Changed to unforked
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'cmdname,cmdbi',i2'0'
|
|
|
|
dc a4'dirsname,dirs',i2'0'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'echoname,echo',i2'0'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'editname,edit',i2'1'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'exitname,exit',i2'1'
|
|
|
|
dc a4'exportname,export',i2'1'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'fgname,fg',i2'1'
|
|
|
|
dc a4'hashname,hashbi',i2'0'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'hname,PrintHistory',i2'0'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'jobsname,jobs',i2'1'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'killname,kill',i2'1'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'popdname,popd',i2'1'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'pfxname,prefix',i2'1'
|
|
|
|
dc a4'psname,psbi',i2'0'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'pushdname,pushd',i2'1'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'pwdname,pwd',i2'1'
|
|
|
|
dc a4'rehashname,rehash',i2'1'
|
|
|
|
dc a4'setname,set',i2'0'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'setbugname,setdebug',i2'0'
|
|
|
|
dc a4'setenvname,setenv',i2'0'
|
1998-09-08 16:53:14 +00:00
|
|
|
dc a4'sourcename,source',i2'1' Changed to unforked
|
1997-11-18 05:31:00 +00:00
|
|
|
dc a4'stopname,stop',i2'1'
|
|
|
|
dc a4'tsetname,tset',i2'1'
|
|
|
|
dc a4'unaliasname,unalias',i2'1'
|
|
|
|
dc a4'unhashname,unhash',i2'1'
|
|
|
|
dc a4'unsetname,unset',i2'1'
|
|
|
|
dc a4'whichname,which',i2'0'
|
|
|
|
dc i4'0,0'
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
aliasname dc c'alias',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
bgname dc c'bg',h'00'
|
|
|
|
bindkeyname dc c'bindkey',h'00'
|
1998-09-08 16:53:14 +00:00
|
|
|
chdirname dc c'chdir',h'00'
|
|
|
|
cdname dc c'cd',h'00'
|
|
|
|
clearname dc c'clear',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
cmdname dc c'commands',h'00'
|
|
|
|
dirsname dc c'dirs',h'00'
|
|
|
|
echoname dc c'echo',h'00'
|
|
|
|
editname dc c'edit',h'00'
|
|
|
|
exitname dc c'exit',h'00'
|
1998-09-08 16:53:14 +00:00
|
|
|
exportname dc c'export',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
fgname dc c'fg',h'00'
|
|
|
|
hashname dc c'hash',h'00'
|
|
|
|
hname dc c'history',h'00'
|
|
|
|
jobsname dc c'jobs',h'00'
|
|
|
|
killname dc c'kill',h'00'
|
|
|
|
pfxname dc c'prefix',h'00'
|
|
|
|
popdname dc c'popd',h'00'
|
|
|
|
psname dc c'ps',h'00'
|
|
|
|
pushdname dc c'pushd',h'00'
|
|
|
|
pwdname dc c'pwd',h'00'
|
1998-09-08 16:53:14 +00:00
|
|
|
rehashname dc c'rehash',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
setbugname dc c'setdebug',h'00'
|
1998-09-08 16:53:14 +00:00
|
|
|
setname dc c'set',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
setenvname dc c'setenv',h'00'
|
|
|
|
sourcename dc c'source',h'00'
|
|
|
|
stopname dc c'stop',h'00'
|
|
|
|
tsetname dc c'tset',h'00'
|
1998-09-08 16:53:14 +00:00
|
|
|
unaliasname dc c'unalias',h'00'
|
|
|
|
unhashname dc c'unhash',h'00'
|
|
|
|
unsetname dc c'unset',h'00'
|
|
|
|
whichname dc c'which',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* CD: builtin command
|
|
|
|
* syntax: cd [pathname]
|
|
|
|
*
|
|
|
|
* Changes the current prefix to pathname. If no pathname then set to $HOME
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
cd START
|
|
|
|
chdir ENTRY
|
|
|
|
|
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
|
|
|
dpg equ 1 Direct page pointer.
|
|
|
|
buf equ dpg+4 Buffer address to be freed.
|
1998-07-20 16:23:11 +00:00
|
|
|
status equ buf+4 Status returned from command.
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
argc equ space+3
|
|
|
|
argv equ argc+2
|
|
|
|
end equ argv+4
|
|
|
|
|
|
|
|
; subroutine (4:argv,2:argc),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
sec
|
|
|
|
sbc #space-1
|
|
|
|
tcs
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
|
|
|
|
lock cdmutex
|
|
|
|
|
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
|
|
|
stz buf Clear the pointer to
|
|
|
|
stz buf+2 allocated buffer.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
stz status Assume good status.
|
|
|
|
|
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 argc Number of parameters
|
|
|
|
dec a determines type of cd...
|
|
|
|
beq cdhome either to $HOME
|
|
|
|
dec a or to the directory
|
|
|
|
jeq paramcd on the command line.
|
|
|
|
|
|
|
|
;
|
|
|
|
; Illegal parameters: print usage string
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
showusage inc status Return status = 1.
|
|
|
|
lda [argv]
|
1997-11-18 05:31:00 +00:00
|
|
|
tax
|
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
stx argv
|
|
|
|
sta argv+2
|
|
|
|
lda [argv],y
|
|
|
|
and #$FF
|
|
|
|
beq cdusage
|
1998-07-20 16:23:11 +00:00
|
|
|
ldx #^Usage2 Print chdir usage
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #Usage2
|
|
|
|
jsr errputs
|
|
|
|
jmp exit
|
1998-07-20 16:23:11 +00:00
|
|
|
cdusage ldx #^Usage Print cd usage
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #Usage
|
|
|
|
jsr errputs
|
|
|
|
jmp exit
|
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
|
|
|
; Set prefix to $home
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-07-20 16:23:11 +00:00
|
|
|
cdhome anop
|
|
|
|
ph4 #home Get value of $HOME
|
|
|
|
jsl getenv
|
|
|
|
sta buf If GS/OS result buffer
|
|
|
|
stx buf+2 wasn't allocated,
|
|
|
|
ora buf+2
|
|
|
|
jeq exit there's no more to do.
|
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
|
|
|
|
|
|
|
clc Calculate address
|
|
|
|
lda buf of GS/OS input string
|
|
|
|
adc #2 (2 bytes from start of
|
|
|
|
sta PRecPath result buffer).
|
|
|
|
sta GRecPath
|
|
|
|
lda buf+2
|
|
|
|
adc #0
|
|
|
|
sta PRecPath+2
|
|
|
|
sta GRecPath+2
|
|
|
|
|
|
|
|
bra getinfo
|
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
|
|
|
; Set prefix to path specified on command line
|
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
|
|
|
paramcd anop
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
ldy #4
|
|
|
|
lda [argv],y
|
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
|
|
|
sta dpg
|
1997-11-18 05:31:00 +00:00
|
|
|
iny2
|
|
|
|
lda [argv],y
|
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
|
|
|
sta dpg+2
|
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 [dpg]
|
1997-11-18 05:31:00 +00:00
|
|
|
and #$FF
|
|
|
|
if2 @a,ne,#'-',setprefix
|
|
|
|
jmp showusage
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
setprefix pei (dpg+2)
|
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
|
|
|
pei (dpg)
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr c2gsstr
|
|
|
|
sta PRecPath
|
|
|
|
sta GRecPath
|
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
|
|
|
sta buf
|
1997-11-18 05:31:00 +00:00
|
|
|
stx PRecPath+2
|
|
|
|
stx GRecPath+2
|
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
|
|
|
stx buf+2
|
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
|
|
|
;
|
|
|
|
; Get file information to determine whether target is a valid directory
|
|
|
|
;
|
|
|
|
getinfo GetFileInfo GRec
|
1997-11-18 05:31:00 +00:00
|
|
|
bcc ok
|
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
|
|
|
ohshit sta ErrError
|
|
|
|
ErrorGS Err
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra done
|
|
|
|
|
|
|
|
ok if2 GRecFT,eq,#$F,ok2
|
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 dpg+2
|
|
|
|
lda dpg
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
|
|
|
ldx #^direrr
|
|
|
|
lda #direrr
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
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
|
|
|
;
|
|
|
|
; Everything looks OK. Set prefix 0 to the indicated value
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
ok2 SetPrefix PRec
|
|
|
|
bcs ohshit
|
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
|
|
|
|
|
|
|
;
|
|
|
|
; Deallocate buffer (if necessary), unlock mutex, cleanup stack, and leave
|
|
|
|
;
|
1998-07-20 16:23:11 +00:00
|
|
|
done ph4 buf
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl nullfree
|
|
|
|
|
|
|
|
exit unlock cdmutex
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
ldy status Put return status in Y-reg
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
lda space
|
|
|
|
sta end-3
|
|
|
|
lda space+1
|
|
|
|
sta end-2
|
|
|
|
pld
|
|
|
|
tsc
|
|
|
|
clc
|
|
|
|
adc #end-4
|
|
|
|
tcs
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
tya Put return status in Accumulator.
|
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
|
|
|
cdmutex key Mutual exclusion key
|
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
|
|
|
; Parameter block for GS/OS SetPrefix call
|
|
|
|
PRec dc i'2' pCount
|
1998-08-03 17:30:30 +00:00
|
|
|
dc i'0' prefixNum (0 = current directory)
|
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
|
|
|
PRecPath ds 4 Pointer to input prefix path
|
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
|
|
|
; Parameter block for GS/OS GetFileInfo call
|
|
|
|
GRec dc i'3' pCount
|
|
|
|
GRecPath ds 4 Pointer to input pathname
|
|
|
|
GRecAcc ds 2 access (result)
|
|
|
|
GRecFT ds 2 fileType (result)
|
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
|
|
|
home gsstr 'home' Env variable name
|
|
|
|
|
|
|
|
; Parameter block for shell ErrorGS call (p 393 in ORCA/M manual)
|
|
|
|
Err dc i2'1' pCount
|
|
|
|
ErrError ds 2 Error number
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
Usage dc c'Usage: cd [pathname]',h'0d00'
|
|
|
|
Usage2 dc c'Usage: chdir [pathname]',h'0d00'
|
|
|
|
dirErr dc c': Not a directory',h'0d00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* CLEAR: builtin command
|
|
|
|
* syntax: clear
|
|
|
|
*
|
|
|
|
* clears the screen
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
clear START
|
|
|
|
|
|
|
|
space equ 1
|
|
|
|
argc equ space+3
|
|
|
|
argv equ argc+2
|
|
|
|
end equ argv+4
|
|
|
|
|
|
|
|
; subroutine (4:argv,2:argc),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
|
|
|
|
lda argc
|
|
|
|
dec a
|
|
|
|
beq clearit
|
|
|
|
|
|
|
|
ldx #^Usage
|
|
|
|
lda #Usage
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
ldy #1 Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra exit
|
|
|
|
|
|
|
|
clearit jsr clearscrn
|
|
|
|
jsr flush
|
1998-12-21 23:57:08 +00:00
|
|
|
ldy #0 Return status = 0.
|
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
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
tya
|
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
|
|
|
|
|
|
|
Usage dc c'Usage: clear',h'0d00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* ECHO: builtin command
|
|
|
|
* syntax: echo [-n] [text][...]
|
|
|
|
*
|
|
|
|
* Echo displays to stdout what is on the command (except -n).
|
|
|
|
*
|
|
|
|
* If '-n' specified then don't print newline.
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
echo START
|
|
|
|
|
|
|
|
val equ 1
|
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
|
|
|
nl equ val+2 flag: was -n option set?
|
1997-11-18 05:31:00 +00:00
|
|
|
ptr equ nl+2
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ ptr+4
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
argc equ space+3
|
|
|
|
argv equ argc+2
|
|
|
|
end equ argv+4
|
|
|
|
|
|
|
|
; subroutine (4:argv,2:argc),space
|
|
|
|
|
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
|
|
|
* Add space on stack for local variables
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
tsc
|
|
|
|
sec
|
|
|
|
sbc #space-1
|
|
|
|
tcs
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
stz status Clear return status.
|
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
|
|
|
stz nl Clear the -n flag.
|
|
|
|
dec argc Decrement argument counter.
|
|
|
|
jeq done Done if no more arguments.
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #4
|
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 [argv],y Set ptr to
|
|
|
|
sta ptr point to the
|
|
|
|
iny2 text of the
|
|
|
|
lda [argv],y first
|
|
|
|
sta ptr+2 argument.
|
|
|
|
ldy #1
|
|
|
|
lda [ptr] Get first
|
|
|
|
and #$FF character.
|
|
|
|
if2 @a,ne,#'-',loop If != '-', handle as regular param.
|
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
|
|
|
|
|
|
|
; First argument begins with "-"; only legal value is -n
|
|
|
|
|
|
|
|
lda [ptr],y Get second
|
1998-09-08 16:53:14 +00:00
|
|
|
and #$FF character.
|
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
|
|
|
if2 @a,eq,#'n',gotn If != 'n', it's a bad one.
|
|
|
|
|
|
|
|
showusage ldx #^Usage Incorrect parameter usage:
|
|
|
|
lda #Usage display the usage string.
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp exit
|
|
|
|
|
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
|
|
|
gotn iny
|
|
|
|
lda [ptr],y Get third
|
|
|
|
and #$FF character.
|
|
|
|
bne showusage If != 0, it's a bad one.
|
|
|
|
inc nl Set the -n flag.
|
|
|
|
add2 argv,#4,argv Bump argument pointer.
|
|
|
|
dec argc Decrement argument counter.
|
|
|
|
jeq done Done if no more arguments.
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
;
|
|
|
|
; Beginning of main processing loop of echo parameters.
|
|
|
|
;
|
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
|
|
|
loop add2 argv,#4,argv Bump argument pointer.
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #2
|
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 [argv],y Set ptr to argv (next argument)
|
1997-11-18 05:31:00 +00:00
|
|
|
sta ptr+2
|
|
|
|
lda [argv]
|
|
|
|
sta ptr
|
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
|
|
|
putloop lda [ptr] Get first
|
|
|
|
and #$FF character.
|
|
|
|
cmp #0 If 0,
|
|
|
|
jeq doneput done with this argument.
|
|
|
|
cmp #'\' If != "\"
|
|
|
|
jne putit go save in print buffer.
|
1998-07-20 16:23:11 +00:00
|
|
|
incad ptr Escape character found; point
|
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 [ptr] to the next
|
|
|
|
and #$FF character.
|
|
|
|
beq doneput If 0, done with this argument.
|
1998-09-08 16:53:14 +00:00
|
|
|
if2 @a,ne,#'b',esc02 Check for escape codes: "b"
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #1
|
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
|
|
|
jsr moveleft moveleft
|
1997-11-18 05:31:00 +00:00
|
|
|
bra didit
|
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
|
|
|
esc02 if2 @a,ne,#'f',esc03 "f"
|
|
|
|
jsr clearscrn clearscreen
|
1997-11-18 05:31:00 +00:00
|
|
|
bra didit
|
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
|
|
|
esc03 if2 @a,ne,#'n',esc04 "n"
|
|
|
|
lda #13 print newline
|
1997-11-18 05:31:00 +00:00
|
|
|
bra putit
|
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
|
|
|
esc04 if2 @a,ne,#'r',esc05 "r"
|
|
|
|
lda #13 print newline
|
1997-11-18 05:31:00 +00:00
|
|
|
bra putit
|
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
|
|
|
esc05 if2 @a,ne,#'t',esc06 "t"
|
|
|
|
lda #9 print tab
|
1997-11-18 05:31:00 +00:00
|
|
|
bra putit
|
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
|
|
|
esc06 if2 @a,ne,#'0',putit "0"
|
|
|
|
stz val decode numeric value
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #1
|
|
|
|
escloop lda [ptr],y
|
|
|
|
and #$FF
|
|
|
|
beq putval
|
|
|
|
if2 @a,cc,#'0',putval
|
|
|
|
if2 @a,cs,#'9'+1,putval
|
|
|
|
sub2 @a,#'0',@a
|
|
|
|
pha
|
|
|
|
lda val
|
|
|
|
asl2 a
|
|
|
|
adc val
|
|
|
|
asl a
|
|
|
|
adc 1,s
|
|
|
|
sta val
|
|
|
|
pla
|
1998-07-20 16:23:11 +00:00
|
|
|
incad ptr
|
1997-11-18 05:31:00 +00:00
|
|
|
bra escloop
|
|
|
|
|
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
|
|
|
putval lda val Get numeric escape code.
|
|
|
|
|
|
|
|
putit jsr putchar Save character in accumulator.
|
1998-07-20 16:23:11 +00:00
|
|
|
didit incad ptr Point to next char in arg
|
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
|
|
|
jmp putloop and go process it.
|
|
|
|
|
|
|
|
doneput dec argc Decrement argument counter.
|
|
|
|
beq done Done if no more arguments.
|
|
|
|
bmi done (or if there were no arguments!)
|
|
|
|
lda #' ' Add a blank
|
|
|
|
jsr putchar between arguments.
|
|
|
|
jmp loop Get next argument.
|
|
|
|
|
|
|
|
done lda nl If "-n" flag isn't set,
|
1997-11-18 05:31:00 +00:00
|
|
|
bne exit
|
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
|
|
|
jsr newline add a newline.
|
|
|
|
|
|
|
|
exit jsr flush Print the buffer.
|
1998-12-21 23:57:08 +00:00
|
|
|
ldy status
|
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
|
|
|
|
|
|
|
* Clear parameters from stack and return from subroutine.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
lda space
|
|
|
|
sta end-3
|
|
|
|
lda space+1
|
|
|
|
sta end-2
|
|
|
|
pld
|
|
|
|
tsc
|
|
|
|
clc
|
|
|
|
adc #end-4
|
|
|
|
tcs
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
tya
|
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
|
|
|
|
|
|
|
Usage dc c'Usage: echo [-n] [strings...]',h'0d00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* PWD: builtin command
|
|
|
|
* syntax: pwd
|
|
|
|
*
|
|
|
|
* print the working directory.
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
pwd START
|
|
|
|
|
|
|
|
ptr equ 1
|
|
|
|
space equ ptr+4
|
|
|
|
argc equ space+3
|
|
|
|
argv equ argc+2
|
|
|
|
end equ argv+4
|
|
|
|
|
|
|
|
; subroutine (4:argv,2:argc),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
sec
|
|
|
|
sbc #space-1
|
|
|
|
tcs
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
|
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
|
|
|
dec argc If an argument was provided,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq wait
|
|
|
|
|
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 #^Usage print the usage string.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #Usage
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
ldy #1 Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra exit
|
|
|
|
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
wait pea 0
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl getpfxstr Get value of prefix 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta ptr
|
|
|
|
stx ptr+2
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
ora ptr+2 If NULL pointer returned,
|
|
|
|
beq done an error was reported.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
ldy #2 If length of returned
|
|
|
|
lda [ptr],y GS/OS string is 0,
|
|
|
|
beq freebuf an error was reported.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
lda ptr X/A = address of
|
|
|
|
clc text (four bytes
|
|
|
|
adc #4 beyond start).
|
|
|
|
bcc doputs
|
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
|
|
|
inx
|
1998-08-03 17:30:30 +00:00
|
|
|
doputs jsr puts Print the c-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
|
|
|
jsr newline and add a newline.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
freebuf ph4 ptr Free the buffer.
|
|
|
|
jsl nullfree
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
done ldy #0 Return status = 0.
|
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
|
|
|
exit lda space Deallocate stack space
|
|
|
|
sta end-3 and return to the caller.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda space+1
|
|
|
|
sta end-2
|
|
|
|
pld
|
|
|
|
tsc
|
|
|
|
clc
|
|
|
|
adc #end-4
|
|
|
|
tcs
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
tya Return status.
|
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
|
|
|
|
|
|
|
Usage dc c'Usage: pwd',h'0d00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* WHICH: builtin command
|
|
|
|
* syntax: which [command ...]
|
|
|
|
*
|
|
|
|
* displays the location of command
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
which START
|
|
|
|
|
|
|
|
using hashdata
|
|
|
|
|
|
|
|
ptr equ 1
|
1998-12-21 23:57:08 +00:00
|
|
|
sptr equ ptr+4
|
|
|
|
file equ sptr+4
|
|
|
|
status equ file+4
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
argc equ space+3
|
|
|
|
argv equ argc+2
|
|
|
|
end equ argv+4
|
|
|
|
|
|
|
|
; subroutine (4:argv,2:argc),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
sec
|
|
|
|
sbc #space-1
|
|
|
|
tcs
|
|
|
|
phd
|
|
|
|
tcd
|
1998-12-21 23:57:08 +00:00
|
|
|
|
|
|
|
stz status Clear return status.
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-12-21 23:57:08 +00:00
|
|
|
; Display usage if no argument
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
if2 argc,ge,#2,loop
|
|
|
|
ldx #^whicherr
|
|
|
|
lda #whicherr
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp exit
|
|
|
|
;
|
|
|
|
; loop through each argument
|
|
|
|
;
|
|
|
|
loop add2 argv,#4,argv
|
|
|
|
dec argc
|
|
|
|
jeq exit
|
|
|
|
|
|
|
|
lda [argv]
|
|
|
|
sta file
|
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
sta file+2
|
|
|
|
|
|
|
|
;
|
|
|
|
; see if it's an alias
|
|
|
|
;
|
|
|
|
pei (file+2)
|
|
|
|
pei (file)
|
|
|
|
jsl findalias
|
|
|
|
sta ptr
|
|
|
|
stx ptr+2
|
|
|
|
ora ptr+2
|
|
|
|
beq chkbuiltin
|
|
|
|
ldx #^aliasstr
|
|
|
|
lda #aliasstr
|
|
|
|
jsr puts
|
|
|
|
ldx ptr+2
|
|
|
|
lda ptr
|
|
|
|
jsr puts
|
|
|
|
jmp nextarg
|
|
|
|
;
|
|
|
|
; was it a built-in?
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
chkbuiltin pei (file+2)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (file)
|
|
|
|
jsl IsBuiltin
|
|
|
|
cmp #-1
|
|
|
|
beq tryhash
|
|
|
|
foundbuiltin ldx #^builtstr
|
|
|
|
lda #builtstr
|
|
|
|
jsr puts
|
|
|
|
jmp nextarg
|
|
|
|
;
|
|
|
|
; See if it was hashed
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
tryhash pei (file+2)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (file)
|
|
|
|
ph4 hash_table
|
|
|
|
ph4 #hash_paths
|
|
|
|
jsl search
|
|
|
|
cmp #0
|
|
|
|
bne foundhash
|
|
|
|
cpx #0
|
|
|
|
beq thispfx
|
|
|
|
;
|
|
|
|
; It was hashed, so say so.
|
|
|
|
;
|
1998-12-21 23:57:08 +00:00
|
|
|
foundhash sta sptr
|
|
|
|
stx sptr+2
|
|
|
|
jsr puts
|
|
|
|
pei (sptr+2) Free memory allocated
|
|
|
|
pei (sptr) by search to hold full path.
|
|
|
|
jsl nullfree
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp nextarg
|
|
|
|
;
|
|
|
|
; It must be in the current prefix, so check it out.
|
|
|
|
;
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
thispfx lock whichmutex
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; check for existence of file
|
|
|
|
;
|
|
|
|
pei (file+2)
|
|
|
|
pei (file)
|
|
|
|
jsr c2gsstr
|
|
|
|
sta GRecPath
|
|
|
|
stx GRecPath+2
|
|
|
|
sta ptr
|
|
|
|
stx ptr+2
|
|
|
|
|
|
|
|
GetFileInfo GRec
|
|
|
|
bcs nofile
|
|
|
|
;
|
|
|
|
; we found the file, so display the cwd
|
|
|
|
;
|
|
|
|
showcwd pei (ptr+2)
|
|
|
|
pei (ptr)
|
|
|
|
jsl nullfree
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
pea 0
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl getpfxstr Get value of prefix 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta ptr
|
|
|
|
stx ptr+2
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
ora ptr+2 If NULL pointer returned,
|
|
|
|
beq donecwd an error was reported.
|
|
|
|
|
|
|
|
ldy #2 If length of returned
|
|
|
|
lda [ptr],y GS/OS string is 0,
|
|
|
|
beq freebuf an error was reported.
|
|
|
|
|
|
|
|
lda ptr X/A = address of
|
|
|
|
clc text (four bytes
|
|
|
|
adc #4 beyond start).
|
|
|
|
bcc doputs
|
|
|
|
inx
|
|
|
|
doputs jsr puts Print the directory name.
|
|
|
|
|
|
|
|
ldx file+2 Print the file name.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda file
|
|
|
|
jsr puts
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
freebuf ph4 ptr Free the buffer.
|
|
|
|
jsl nullfree
|
1997-11-18 05:31:00 +00:00
|
|
|
stz ptr
|
|
|
|
stz ptr+2
|
|
|
|
bra donecwd
|
|
|
|
;
|
|
|
|
; No such command
|
|
|
|
;
|
|
|
|
nofile ldx #^cantdoit
|
|
|
|
lda #cantdoit
|
|
|
|
jsr puts
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
donecwd unlock whichmutex
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (ptr+2)
|
|
|
|
pei (ptr)
|
|
|
|
jsl nullfree
|
|
|
|
;
|
|
|
|
; Go try the next file.
|
|
|
|
;
|
|
|
|
nextarg jsr newline
|
|
|
|
jmp loop
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit ldy status
|
|
|
|
lda space
|
1997-11-18 05:31:00 +00:00
|
|
|
sta end-3
|
|
|
|
lda space+1
|
|
|
|
sta end-2
|
|
|
|
pld
|
|
|
|
tsc
|
|
|
|
clc
|
|
|
|
adc #end-4
|
|
|
|
tcs
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
tya
|
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
|
|
|
|
|
|
|
whicherr dc c'Usage: which [file ...]',h'0d00'
|
|
|
|
builtstr dc c'Shell Built-in Command',h'00'
|
|
|
|
cantdoit dc c'Command Not Found',h'00'
|
|
|
|
aliasstr dc c'Aliased as ',h'00'
|
|
|
|
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
whichmutex key
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
GRec dc i'4'
|
|
|
|
GRecPath ds 4
|
|
|
|
ds 2
|
1998-09-08 16:53:14 +00:00
|
|
|
GRecFileType ds 2
|
|
|
|
GRecAuxType ds 4
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* PREFIX: builtin command
|
|
|
|
* syntax: prefix [num [prefix]]
|
|
|
|
*
|
1998-12-21 23:57:08 +00:00
|
|
|
* sets prefix number num to prefix or print list of all prefixes
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
prefix START
|
|
|
|
|
|
|
|
dir equ 1
|
|
|
|
numstr equ dir+4
|
1998-08-03 17:30:30 +00:00
|
|
|
pfxnum equ numstr+4
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ pfxnum+2
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
argc equ space+3
|
|
|
|
argv equ argc+2
|
|
|
|
end equ argv+4
|
|
|
|
|
|
|
|
; subroutine (4:argv,2:argc),space
|
|
|
|
|
|
|
|
tsc
|
|
|
|
sec
|
|
|
|
sbc #space-1
|
|
|
|
tcs
|
|
|
|
phd
|
|
|
|
tcd
|
|
|
|
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
lock prefixmutex
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
stz status Clear return status.
|
1998-08-03 17:30:30 +00:00
|
|
|
lda argc Get number of arguments.
|
1997-11-18 05:31:00 +00:00
|
|
|
dec a
|
1998-08-03 17:30:30 +00:00
|
|
|
beq showall If no parameters, show all prefixes.
|
1997-11-18 05:31:00 +00:00
|
|
|
dec a
|
1998-08-03 17:30:30 +00:00
|
|
|
jeq showone If one, show one.
|
1997-11-18 05:31:00 +00:00
|
|
|
dec a
|
1998-08-03 17:30:30 +00:00
|
|
|
jeq setprefix If two, set a prefix.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
ldx #^usage
|
|
|
|
lda #usage
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
jmp badstat
|
|
|
|
|
|
|
|
; -------------------------------------------------------------------
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; No parameters provided: show all the prefixes
|
|
|
|
;
|
|
|
|
showall anop
|
|
|
|
lda #$FFFF
|
|
|
|
sta pfxnum First prefix # will be 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
pha Get the boot volume string.
|
|
|
|
jsl getpfxstr
|
1997-11-18 05:31:00 +00:00
|
|
|
sta dir
|
|
|
|
stx dir+2
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
ora dir+2 If NULL pointer returned,
|
|
|
|
beq bumppfx an error was reported.
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #^bootstr
|
|
|
|
lda #bootstr
|
1998-12-21 23:57:08 +00:00
|
|
|
bra printid Jump into the loop
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
allloop lda pfxnum
|
|
|
|
pha
|
|
|
|
jsl getpfxstr
|
|
|
|
sta dir
|
|
|
|
stx dir+2
|
|
|
|
|
|
|
|
ora dir+2 If NULL pointer returned,
|
|
|
|
beq bumppfx an error was reported.
|
|
|
|
|
|
|
|
ldy #2 Get length word.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [dir],y
|
1998-08-03 17:30:30 +00:00
|
|
|
beq nextall If zero, do the next prefix.
|
|
|
|
Int2Dec (pfxnum,#pfxstr,#2,#0)
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #^pfxstr
|
|
|
|
lda #pfxstr
|
1998-12-21 23:57:08 +00:00
|
|
|
printid jsr puts
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx dir+2
|
1998-08-03 17:30:30 +00:00
|
|
|
lda dir X/A = address of
|
|
|
|
clc text (four bytes
|
|
|
|
adc #4 beyond start).
|
|
|
|
bcc doputs2
|
|
|
|
inx
|
|
|
|
doputs2 jsr puts Print the directory name
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr newline
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
nextall ph4 dir Free the GS/OS result buffer
|
|
|
|
jsl nullfree allocated for pathname.
|
|
|
|
bumppfx inc pfxnum Bump the prefix number.
|
|
|
|
if2 pfxnum,cc,#32,allloop
|
1998-12-21 23:57:08 +00:00
|
|
|
jmp done
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
; -------------------------------------------------------------------
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; One parameter provided: show a single prefix
|
|
|
|
;
|
|
|
|
showone ldy #1*4+2 Put pointer to
|
|
|
|
lda [argv],y first command
|
|
|
|
sta numstr+2 argument in
|
|
|
|
pha numstr, and
|
|
|
|
dey2 also on stack
|
|
|
|
lda [argv],y as parameter.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta numstr
|
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
jsr cstrlen Get length of argument.
|
1997-11-18 05:31:00 +00:00
|
|
|
tax
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
Dec2Int (numstr,@x,#0),@a Convert to integer.
|
1998-08-03 17:30:30 +00:00
|
|
|
cmp #32 If prefix num >= 32,
|
|
|
|
bcc getpfx
|
|
|
|
jsr newline just print blank line.
|
|
|
|
jmp done
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
getpfx pha Get that prefix value.
|
|
|
|
jsl getpfxstr
|
1997-11-18 05:31:00 +00:00
|
|
|
sta dir
|
|
|
|
stx dir+2
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
ora dir+2 If NULL pointer returned,
|
|
|
|
jeq done an error was reported.
|
|
|
|
|
|
|
|
Int2Dec (pfxnum,#pfxstr,#2,#0)
|
|
|
|
|
|
|
|
ldy #2 Get length word.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [dir],y
|
1998-08-03 17:30:30 +00:00
|
|
|
beq donewline If zero, just print newline.
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx dir+2
|
1998-08-03 17:30:30 +00:00
|
|
|
lda dir X/A = address of
|
|
|
|
clc text (four bytes
|
|
|
|
adc #4 beyond start).
|
|
|
|
bcc doputs3
|
|
|
|
inx
|
|
|
|
doputs3 jsr puts Print the directory name
|
|
|
|
donewline jsr newline
|
|
|
|
ph4 dir Free the GS/OS result buffer
|
|
|
|
jsl nullfree allocated for pathname.
|
|
|
|
jmp done
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
; -------------------------------------------------------------------
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; Two parameters provided: set a prefix
|
|
|
|
;
|
|
|
|
setprefix ldy #1*4+2 Put pointer to
|
|
|
|
lda [argv],y first command
|
|
|
|
sta numstr+2 argument (prefix
|
|
|
|
pha num) in numstr, and
|
|
|
|
dey2 also on stack
|
|
|
|
lda [argv],y as parameter.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta numstr
|
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
jsr cstrlen Get length of argument.
|
1997-11-18 05:31:00 +00:00
|
|
|
tax
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
Dec2Int (numstr,@x,#0),PRecNum Convert to integer string.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
lda PRecNum
|
1998-08-03 17:30:30 +00:00
|
|
|
cmp #32 If prefix num >= 32,
|
|
|
|
bcs done nothing to do.
|
|
|
|
|
|
|
|
ldy #2*4+2 Put pointer to
|
|
|
|
lda [argv],y second command
|
|
|
|
pha argument (value)
|
|
|
|
dey2 on stack as parameter.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [argv],y
|
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
jsr c2gsstr Convert to GS string.
|
|
|
|
|
|
|
|
sta GRecPath Store in GetFileInfo
|
|
|
|
stx GRecPath+2 parameter block and
|
|
|
|
sta PRecPath SetPrefix p.b.
|
1997-11-18 05:31:00 +00:00
|
|
|
stx PRecPath+2
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; Get file information to determine whether target is a valid directory
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
GetFileInfo GRec
|
1998-08-03 17:30:30 +00:00
|
|
|
bcc ok
|
|
|
|
sta ErrError
|
|
|
|
ErrorGS Err
|
|
|
|
bra done
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
ok if2 GRecFT,eq,#$F,ok2 If filetype != $F,
|
1998-08-03 17:30:30 +00:00
|
|
|
ldx #^direrr print error message
|
|
|
|
lda #direrr 'Not a directory'
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
badstat inc status Return status = 1.
|
1998-08-03 17:30:30 +00:00
|
|
|
bra done
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
ok2 SetPrefix PRec Set the prefix.
|
|
|
|
bcc finish If error flag set,
|
|
|
|
ldx #^errorstr print error message
|
|
|
|
lda #errorstr 'could not set prefix,
|
|
|
|
jsr errputs pathname may not exist.'
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
; -------------------------------------------------------------------
|
|
|
|
;
|
|
|
|
; All done: cleanup and return
|
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
finish ph4 PRecPath Free the name string buffer.
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl nullfree
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
;
|
|
|
|
; Exit through here if PRecPath wasn't used
|
|
|
|
;
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
done unlock prefixmutex
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
ldy status
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
lda space
|
|
|
|
sta end-3
|
|
|
|
lda space+1
|
|
|
|
sta end-2
|
|
|
|
pld
|
|
|
|
tsc
|
|
|
|
clc
|
|
|
|
adc #end-4
|
|
|
|
tcs
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
tya
|
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
|
|
|
|
Changes for gsh version 2.0d8:
Fixed several mutual exclusion problems, including a particularly nasty
one that would cause gsh to loop forever inside the memory manager. (You
could identify this one by the "BRA (-23)" at the bottom of the infinite
loop.)
Fixed the string vector print routine to properly handle all numbers of
entries in the hash table. Previously, it would always print duplicate
entries if there were < 6 commands hashed, and would sometimes print
duplicates (depending on previous contents of an internal table) for
other numbers of commands.
gsh would wait on background processes started from an exec file
(executed, not sourced). Now the exec file does not wait on the process,
but the background process is not associated with the parent shell after
the exec file terminates.
Made gsh globbing work more like csh: if none of the requested patterns
are found, print "No match" and exit.
At startup, if /etc/glogin, $HOME/glogin, or $HOME/gshrc does not exist,
don't report a "file not found" error message. (PR#100)
1998-12-31 18:29:14 +00:00
|
|
|
prefixmutex key
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
errorstr dc c'prefix: could not set prefix, pathname may not exist.'
|
|
|
|
dc h'0d00'
|
|
|
|
usage dc c'Usage: prefix prefixnum prefixname',h'0d00'
|
|
|
|
bootstr dc c' *: ',h'00'
|
|
|
|
pfxstr dc c'00: ',h'00'
|
1998-08-03 17:30:30 +00:00
|
|
|
dirErr dc c'prefix: Not a directory',h'0d00'
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; Parameter block for GS/OS GetFileInfo call
|
|
|
|
;
|
|
|
|
GRec dc i'3' pCount
|
|
|
|
GRecPath ds 4 Pointer to input pathname
|
|
|
|
GRecAcc ds 2 access (result)
|
|
|
|
GRecFT ds 2 fileType (result)
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; Parameter buffer for SetPrefix GS/OS call
|
|
|
|
;
|
|
|
|
PRec dc i'2' pCount
|
|
|
|
PRecNum dc i'0' prefix number
|
|
|
|
PRecPath ds 4 pointer to GS/OS string with value
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; Parameter block for shell ErrorGS call (p 393 in ORCA/M manual)
|
|
|
|
;
|
|
|
|
Err dc i2'1' pCount
|
|
|
|
ErrError ds 2 Error number
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* REHASH: builtin command
|
|
|
|
* syntax: rehash
|
|
|
|
*
|
|
|
|
* rehashes the path
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* UNHASH: builtin command
|
|
|
|
* syntax: unhash
|
|
|
|
*
|
|
|
|
* turns off command hashing
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
rehash START
|
|
|
|
unhash ENTRY
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ 0
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
|
|
|
stz status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
lda argc
|
|
|
|
dec a
|
|
|
|
beq doit
|
|
|
|
|
|
|
|
ldx #^Usage
|
|
|
|
lda #Usage
|
|
|
|
jsr errputs
|
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
tax
|
|
|
|
lda [argv]
|
|
|
|
jsr errputs
|
|
|
|
lda #13
|
|
|
|
jsr errputchar
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra exit
|
|
|
|
|
|
|
|
doit jsr dispose_hash ;remove old table
|
|
|
|
lda [argv]
|
|
|
|
tax
|
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
sta argv+2
|
|
|
|
stx argv
|
|
|
|
lda [argv]
|
|
|
|
and #$FF
|
|
|
|
jsr tolower
|
|
|
|
if2 @a,eq,#'u',exit ;if 'rehash' do the hashing.
|
|
|
|
jsl hashpath ;hash the path
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit return 2:status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
Usage dc c'Usage: ',h'00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* EXIT: builtin command
|
|
|
|
* syntax: exit
|
|
|
|
*
|
|
|
|
* exit gsh
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
exit START
|
|
|
|
|
|
|
|
using global
|
|
|
|
|
|
|
|
space equ 0
|
|
|
|
|
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
inc exit_requested
|
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
|
|
|
return 2:#0
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* SETDEBUG: builtin command
|
|
|
|
* syntax: setdebug (val | [+|-]flag)
|
|
|
|
*
|
|
|
|
* sets debugging in kernel
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
setdebug START
|
|
|
|
|
|
|
|
arg equ 0
|
|
|
|
newdebug equ arg+4
|
|
|
|
mode equ newdebug+2
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ mode+2
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
stz status
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
lda argc
|
|
|
|
dec a
|
|
|
|
bne ok
|
|
|
|
showusage ldx #^usage
|
|
|
|
lda #usage
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp return
|
|
|
|
|
|
|
|
ok stz mode
|
|
|
|
mv2 globaldebug,newdebug
|
|
|
|
dec argc
|
|
|
|
add2 argv,#4,argv
|
|
|
|
loop lda [argv]
|
|
|
|
sta arg
|
|
|
|
ldy #2
|
|
|
|
lda [argv],y
|
|
|
|
sta arg+2
|
|
|
|
lda [arg]
|
|
|
|
and #$FF
|
|
|
|
if2 @a,eq,#'-',turnoff
|
|
|
|
if2 @a,eq,#'+',turnon
|
1998-09-08 16:53:14 +00:00
|
|
|
ldx mode
|
1997-11-18 05:31:00 +00:00
|
|
|
bne showusage
|
|
|
|
ldx argc
|
|
|
|
dex
|
|
|
|
bne showusage
|
|
|
|
if2 @a,cc,#'0',showusage
|
|
|
|
if2 @a,cs,#'9'+1,showusage
|
|
|
|
pei (arg+2)
|
|
|
|
pei (arg)
|
|
|
|
jsr cstrlen
|
|
|
|
tax
|
|
|
|
Dec2Int (arg,@x,#0),@a
|
|
|
|
sta newdebug
|
|
|
|
jmp done
|
|
|
|
|
|
|
|
turnoff jsr findflag
|
|
|
|
eor #$FFFF
|
|
|
|
and newdebug
|
|
|
|
bra turnnext
|
|
|
|
turnon jsr findflag
|
|
|
|
ora newdebug
|
|
|
|
turnnext sta newdebug
|
|
|
|
ld2 1,mode
|
|
|
|
add2 argv,#4,argv
|
|
|
|
dec argc
|
|
|
|
beq done
|
|
|
|
jmp loop
|
|
|
|
|
|
|
|
done setdebug newdebug
|
|
|
|
mv2 newdebug,globaldebug
|
1998-12-21 23:57:08 +00:00
|
|
|
return return 2:status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
findflag incad arg
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #0
|
|
|
|
findloop phy
|
|
|
|
lda nametbl,y
|
|
|
|
ora nametbl+2,y
|
|
|
|
beq nofind
|
|
|
|
lda nametbl+2,y
|
|
|
|
pha
|
|
|
|
lda nametbl,y
|
|
|
|
pha
|
|
|
|
pei (arg+2)
|
|
|
|
pei (arg)
|
|
|
|
jsr cmpcstr
|
|
|
|
beq foundit
|
|
|
|
pla
|
|
|
|
add2 @a,#4,@y
|
|
|
|
bra findloop
|
|
|
|
|
|
|
|
foundit pla
|
|
|
|
lsr a
|
|
|
|
tax
|
|
|
|
lda bittbl,x
|
|
|
|
rts
|
|
|
|
|
|
|
|
nofind pla
|
|
|
|
ldx arg+2
|
|
|
|
lda arg
|
|
|
|
jsr errputs
|
|
|
|
ldx #^errstr
|
|
|
|
lda #errstr
|
|
|
|
jsr errputs
|
|
|
|
lda #-1
|
|
|
|
pla ;rts address
|
|
|
|
jmp showusage
|
|
|
|
|
|
|
|
usage dc c'Usage: setdebug (value | [+|-]flag ... )',h'0d0d'
|
|
|
|
dc c'Flags: gsostrace - Trace GS/OS calls',h'0d'
|
|
|
|
dc c' gsosblocks - Trace GS/OS parameter blocks',h'0d'
|
|
|
|
dc c' gsoserrors - Trace GS/OS errors',h'0d'
|
|
|
|
dc c' pathtrace - Trace GS/OS pathnames',h'0d'
|
|
|
|
dc c' sigtrace - Trace signals',h'0d'
|
|
|
|
dc c' systrace - Trace system calls',h'0d'
|
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 line is temporary
|
|
|
|
dc c' breakpoint - Coded brk instructions',h'0d'
|
1997-11-18 05:31:00 +00:00
|
|
|
dc h'00'
|
|
|
|
|
|
|
|
errstr dc c': Unknown flag',h'0d0d00'
|
|
|
|
|
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
|
|
|
nametbl dc a4'str01,str02,str03,str04,str05,str06,str07,0'
|
1997-11-18 05:31:00 +00:00
|
|
|
str01 dc c'gsostrace',h'00'
|
|
|
|
str02 dc c'pathtrace',h'00'
|
|
|
|
str03 dc c'gsoserrors',h'00'
|
|
|
|
str04 dc c'sigtrace',h'00'
|
|
|
|
str05 dc c'systrace',h'00'
|
|
|
|
str06 dc c'gsosblocks',h'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 line is temporary; Also: remove str07 in nametbl
|
|
|
|
str07 dc c'breakpoint',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
bittbl dc i2'%000001'
|
|
|
|
dc i2'%000010'
|
|
|
|
dc i2'%000100'
|
|
|
|
dc i2'%001000'
|
|
|
|
dc i2'%010000'
|
|
|
|
dc i2'%100000'
|
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 line is temporary
|
|
|
|
dc i2'%10000000'
|
|
|
|
|
|
|
|
* >> Next line is temporary
|
|
|
|
check4debug ENTRY
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
globaldebug dc i2'0'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* PS: builtin command
|
|
|
|
* syntax: ps
|
|
|
|
*
|
|
|
|
* display process status
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
psbi START
|
|
|
|
|
|
|
|
using pdata
|
|
|
|
|
|
|
|
myuid equ 0
|
|
|
|
t equ myuid+2
|
|
|
|
ps2 equ t+4
|
|
|
|
pr2 equ ps2+4
|
|
|
|
pr equ pr2+4
|
|
|
|
ps equ pr+4
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ ps+4
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
stz status
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
lda argc
|
|
|
|
dec a
|
|
|
|
beq ok
|
|
|
|
showusage ldx #^usage
|
|
|
|
lda #usage
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp return
|
|
|
|
|
|
|
|
ok getuid
|
1998-09-08 16:53:14 +00:00
|
|
|
sta myuid
|
1997-11-18 05:31:00 +00:00
|
|
|
kvm_open
|
|
|
|
sta ps
|
|
|
|
stx ps+2
|
|
|
|
ora2 @a,ps+2,@a
|
|
|
|
bne ok2
|
|
|
|
ldx #^kvmerrstr
|
|
|
|
lda #kvmerrstr
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp done
|
|
|
|
|
|
|
|
ok2 ldx #^header
|
|
|
|
lda #header
|
|
|
|
jsr puts
|
|
|
|
|
|
|
|
loop kvmnextproc ps
|
|
|
|
sta pr
|
|
|
|
stx pr+2
|
|
|
|
ora2 @a,pr+2,@a
|
|
|
|
jeq done
|
|
|
|
|
|
|
|
ldy #94 ;ps->p_uid
|
|
|
|
lda [pr],y
|
|
|
|
cmp myuid
|
|
|
|
jne skip
|
|
|
|
|
|
|
|
ldy #2
|
|
|
|
lda [ps],y ;ps->pid
|
|
|
|
Int2Dec (@a,#pidstr,#4,#0)
|
|
|
|
ldx #^pidstr
|
|
|
|
lda #pidstr
|
|
|
|
jsr puts
|
|
|
|
|
|
|
|
ldy #2
|
|
|
|
lda [pr],y ;pr->processState
|
|
|
|
cmp #9
|
|
|
|
bcc okstate
|
|
|
|
lda #9
|
|
|
|
okstate asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tax
|
|
|
|
ldy #8
|
|
|
|
putstate lda statetbl,x
|
|
|
|
phx
|
|
|
|
phy
|
|
|
|
jsr putchar
|
|
|
|
ply
|
|
|
|
plx
|
|
|
|
inx
|
|
|
|
dey
|
|
|
|
bne putstate
|
|
|
|
|
|
|
|
ldy #6
|
|
|
|
lda [pr],y ;pr->ttyID
|
|
|
|
beq ttnul
|
|
|
|
cmp #3
|
|
|
|
bne ttnum
|
|
|
|
lda #'c'
|
|
|
|
jsr putchar
|
|
|
|
lda #'o'
|
|
|
|
bra showuser
|
|
|
|
ttnul lda #'n'
|
|
|
|
jsr putchar
|
|
|
|
lda #'u'
|
|
|
|
bra showuser
|
|
|
|
ttnum ldy #0
|
|
|
|
ttnumlup cmp #10
|
|
|
|
bcc ttnum0
|
|
|
|
sec
|
|
|
|
sbc #10
|
|
|
|
iny
|
|
|
|
bra ttnumlup
|
|
|
|
ttnum0 pha
|
|
|
|
tya
|
|
|
|
clc
|
|
|
|
adc #'0'
|
|
|
|
jsr putchar
|
|
|
|
pla
|
|
|
|
clc
|
|
|
|
adc #'0'
|
|
|
|
showuser jsr putchar
|
|
|
|
|
|
|
|
ldy #4
|
|
|
|
lda [pr],y ;pr->userID
|
|
|
|
Int2Hex (@a,#userstr+1,#4)
|
|
|
|
ldx #^userstr
|
|
|
|
lda #userstr
|
|
|
|
jsr puts
|
|
|
|
|
|
|
|
ldy #94
|
|
|
|
lda [pr],y ;pr->puid
|
|
|
|
Int2Hex (@a,#puidstr,#4)
|
|
|
|
ldx #^puidstr
|
|
|
|
lda #puidstr
|
|
|
|
jsr puts
|
|
|
|
|
|
|
|
ldy #50
|
|
|
|
lda [pr],y ;pr->ticks
|
|
|
|
tax
|
|
|
|
iny2
|
|
|
|
lda [pr],y
|
|
|
|
LongDivide (@ax,#60),(@ax,@yy)
|
|
|
|
LongDivide (@xa,#60),(t,@ax)
|
|
|
|
Long2Dec (@xa,#timestr+4,#2,#0)
|
|
|
|
Long2Dec (t,#timestr,#3,#0)
|
|
|
|
lda timestr+4
|
|
|
|
and #$FF
|
|
|
|
cmp #' '
|
|
|
|
bne time0
|
|
|
|
short a
|
|
|
|
lda #'0'
|
|
|
|
sta timestr+4
|
|
|
|
long a
|
|
|
|
time0 ldx #^timestr
|
|
|
|
lda #timestr
|
|
|
|
jsr puts
|
|
|
|
|
|
|
|
ldy #34
|
|
|
|
lda [pr],y ;pr->args
|
|
|
|
tax
|
|
|
|
iny2
|
|
|
|
lda [pr],y
|
|
|
|
jne goodcmd
|
|
|
|
cpx #0
|
|
|
|
jne goodcmd
|
|
|
|
|
|
|
|
lda pjoblist ;check for name in job list
|
|
|
|
ldx pjoblist+2
|
|
|
|
|
|
|
|
jobloop sta pr2
|
|
|
|
stx pr2+2
|
|
|
|
|
|
|
|
ora pr2+2
|
|
|
|
beq childof
|
|
|
|
ldy #p_pid
|
|
|
|
lda [pr2],y
|
|
|
|
ldy #2
|
|
|
|
cmp [ps],y ;ps->pid
|
|
|
|
bne loop2
|
|
|
|
|
|
|
|
ldy #p_command+2
|
|
|
|
lda [pr2],y
|
|
|
|
tax
|
|
|
|
ldy #p_command
|
|
|
|
lda [pr2],y
|
|
|
|
jsr puts
|
|
|
|
bra next
|
|
|
|
|
|
|
|
loop2 ldy #p_next+2
|
|
|
|
lda [pr2],y
|
|
|
|
tax
|
|
|
|
ldy #p_next
|
|
|
|
lda [pr2],y
|
|
|
|
bra jobloop
|
|
|
|
|
|
|
|
childof ldx #^forkstr
|
|
|
|
lda #forkstr
|
|
|
|
jsr puts
|
|
|
|
kvm_open
|
|
|
|
sta ps2
|
|
|
|
stx ps2+2
|
|
|
|
lda [pr]
|
|
|
|
tay
|
|
|
|
kvmgetproc (ps2,@y)
|
|
|
|
sta pr2
|
|
|
|
stx pr2+2
|
|
|
|
kvm_close ps2
|
|
|
|
ldy #34
|
|
|
|
lda [pr2],y ;pr2->args
|
|
|
|
tax
|
|
|
|
iny2
|
|
|
|
lda [pr2],y
|
|
|
|
bne goodcmd
|
|
|
|
cpx #0
|
|
|
|
bne goodcmd
|
|
|
|
|
|
|
|
ldx #^forkstr2
|
|
|
|
lda #forkstr2
|
|
|
|
jsr puts
|
|
|
|
bra next
|
|
|
|
|
|
|
|
goodcmd tay
|
|
|
|
txa
|
|
|
|
tyx
|
|
|
|
clc
|
|
|
|
adc #8
|
|
|
|
jsr puts
|
|
|
|
|
|
|
|
next jsr newline
|
|
|
|
skip jmp loop
|
|
|
|
|
|
|
|
done kvm_close ps
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
return return 2:status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
usage dc c'Usage: ps',h'0d00'
|
|
|
|
kvmerrstr dc c'ps: error in kvm_open()',h'0d00'
|
|
|
|
header dc c' ID STATE TT MMID UID TIME COMMAND',h'0d00'
|
|
|
|
pidstr dc c'0000 ',h'00'
|
|
|
|
userstr dc c' 0000 ',h'00'
|
|
|
|
puidstr dc c'0000 ',h'00'
|
|
|
|
timestr dc c'000:00 ',h'00'
|
|
|
|
forkstr dc c'forked child of ',h'00'
|
|
|
|
forkstr2 dc c'an unknown process',h'00'
|
|
|
|
|
|
|
|
test1 dc c'getuid = $'
|
|
|
|
test1a dc c'0000',h'0d00'
|
|
|
|
|
|
|
|
statetbl dc c'defunct '
|
|
|
|
dc c'running '
|
|
|
|
dc c'ready '
|
|
|
|
dc c'blocked '
|
|
|
|
dc c'ready '
|
|
|
|
dc c'suspend '
|
|
|
|
dc c'waiting '
|
|
|
|
dc c'waiting '
|
|
|
|
dc c'paused '
|
|
|
|
dc c'unknown '
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* HASH: builtin command
|
|
|
|
* syntax: hash
|
|
|
|
*
|
|
|
|
* display hashed commands
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
hashbi START
|
|
|
|
|
|
|
|
using hashdata
|
|
|
|
|
|
|
|
sv equ 0
|
|
|
|
q equ sv+4
|
|
|
|
p equ q+4
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ p+4
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
stz status
|
|
|
|
|
|
|
|
lda argc
|
|
|
|
dec a
|
|
|
|
beq dohash
|
|
|
|
|
|
|
|
ldx #^Usage
|
|
|
|
lda #Usage
|
|
|
|
jsr errputs
|
|
|
|
inc status Return status = 1.
|
|
|
|
bra exit
|
|
|
|
|
|
|
|
dohash ph2 t_size Get size of hash table.
|
1998-07-20 16:23:11 +00:00
|
|
|
jsl sv_alloc Allocate a string vector array.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta sv
|
|
|
|
stx sv+2
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
lda hash_table If no hash table
|
|
|
|
ora hash_table+2 has been allocated,
|
|
|
|
beq exit exit.
|
|
|
|
|
|
|
|
mv4 hash_table,p Move address to dir pg variable.
|
|
|
|
lda hash_numexe Get the number of executable files.
|
|
|
|
beq doneadd Done if 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; loop through every hashed file and add it the string vector
|
|
|
|
;
|
1998-07-20 16:23:11 +00:00
|
|
|
ldy #0 Y is index into the next entry.
|
|
|
|
ldx t_size X is the number of entries left.
|
|
|
|
beq doneadd
|
|
|
|
addloop lda [p],y Get next hash table entry.
|
|
|
|
sta q
|
1997-11-18 05:31:00 +00:00
|
|
|
iny
|
|
|
|
iny
|
|
|
|
lda [p],y
|
|
|
|
sta q+2
|
|
|
|
iny
|
|
|
|
iny
|
1998-07-20 16:23:11 +00:00
|
|
|
ora q If this entry isn't used,
|
|
|
|
beq skip skip to the next one.
|
|
|
|
|
|
|
|
phy Hold the Y and X regs on stack.
|
1997-11-18 05:31:00 +00:00
|
|
|
phx
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (sv+2) Insert string in table entry
|
|
|
|
pei (sv) into the string vector.
|
|
|
|
clc
|
1997-11-18 05:31:00 +00:00
|
|
|
lda q
|
1998-07-20 16:23:11 +00:00
|
|
|
adc #2 (Note: tn_name in hash.asm == 2)
|
|
|
|
tax
|
|
|
|
lda q+2
|
|
|
|
adc #0
|
1997-11-18 05:31:00 +00:00
|
|
|
pha
|
1998-07-20 16:23:11 +00:00
|
|
|
phx
|
|
|
|
pea 1 (allocflag: 1 = allocate memory)
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl sv_add
|
1998-07-20 16:23:11 +00:00
|
|
|
plx Restore X and Y regs from stack.
|
1997-11-18 05:31:00 +00:00
|
|
|
ply
|
|
|
|
skip dex
|
|
|
|
bne addloop
|
1998-07-20 16:23:11 +00:00
|
|
|
;
|
|
|
|
; Files have all been added to the string vector
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
doneadd anop
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (sv+2)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (sv)
|
1998-07-20 16:23:11 +00:00
|
|
|
jsl sv_sort Sort the string vector.
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
1998-07-20 16:23:11 +00:00
|
|
|
jsl sv_colprint Print the string vector in columns.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
1998-07-20 16:23:11 +00:00
|
|
|
jsl sv_dispose Dispose of the string vector memory.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit return 2:status
|
|
|
|
|
|
|
|
usage dc c'Usage: hash',h'0d00'
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* SOURCE: builtin command
|
|
|
|
* syntax: source file [arguments...]
|
|
|
|
*
|
|
|
|
* executes a shell file w/o pushing environment
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
source START
|
|
|
|
|
|
|
|
retval equ 0
|
|
|
|
space equ retval+2
|
|
|
|
|
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
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
|
|
|
dec argc If no filename was provided,
|
1997-11-18 05:31:00 +00:00
|
|
|
bne ok
|
|
|
|
|
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 #^usage Print usage string.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #usage
|
|
|
|
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
|
|
|
lda #1 Return error status.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta retval
|
|
|
|
bra exit
|
|
|
|
|
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
|
|
|
ok stz retval
|
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
|
|
|
add2 argv,#4,argv
|
|
|
|
|
|
|
|
* ShellExec subroutine (4:path,2:argc,4:argv,2:jobflag)
|
|
|
|
|
|
|
|
ldy #2 path is filename argument
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [argv],y
|
|
|
|
pha
|
|
|
|
lda [argv]
|
|
|
|
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
|
|
|
pei (argc) reuse argc
|
|
|
|
pei (argv+2) reuse argv
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (argv)
|
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
|
|
|
pea 0 jobflag = 0
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl ShellExec
|
|
|
|
sta retval
|
|
|
|
|
|
|
|
exit return 2:retval
|
|
|
|
|
|
|
|
usage dc c'usage: source file [arguments...]',h'0d00'
|
|
|
|
|
|
|
|
END
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* COMMANDS: builtin command
|
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
|
|
|
* syntax: commands
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* display builtin commands
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
cmdbi START
|
|
|
|
|
|
|
|
using BuiltinData
|
|
|
|
|
|
|
|
sv equ 0
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ sv+4
|
|
|
|
space equ status+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
subroutine (4:argv,2:argc),space
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
stz status
|
|
|
|
|
|
|
|
lda argc
|
|
|
|
dec a
|
|
|
|
beq docmds
|
|
|
|
|
|
|
|
ldx #^Usage
|
|
|
|
lda #Usage
|
|
|
|
jsr errputs
|
|
|
|
inc status Return status = 1.
|
|
|
|
bra exit
|
|
|
|
|
|
|
|
docmds ph2 #50
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl sv_alloc
|
|
|
|
|
|
|
|
sta sv
|
|
|
|
stx sv+2
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
;
|
|
|
|
; loop through every hashed file and add it the string vector
|
|
|
|
;
|
|
|
|
addloop lda builtintbl,x
|
|
|
|
ora builtintbl+2,x
|
|
|
|
beq doneadd
|
|
|
|
phx
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
|
|
|
lda builtintbl+2,x
|
|
|
|
pha
|
|
|
|
lda builtintbl,x
|
|
|
|
pha
|
|
|
|
pea 1
|
|
|
|
jsl sv_add
|
|
|
|
pla
|
|
|
|
clc
|
|
|
|
adc #10
|
|
|
|
tax
|
|
|
|
bra addloop
|
|
|
|
doneadd anop
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (sv+2)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (sv)
|
|
|
|
jsl sv_sort
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
|
|
|
jsl sv_colprint
|
|
|
|
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
|
|
|
jsl sv_dispose
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit return 2:status
|
|
|
|
|
|
|
|
usage dc c'Usage: commands',h'0d00'
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|