1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
1998-12-21 23:57:08 +00:00
|
|
|
* $Id: dir.asm,v 1.8 1998/12/21 23:57:05 tribby Exp $
|
1998-04-24 15:38:47 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* DIR.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
|
|
|
*
|
|
|
|
* Directory stack management
|
|
|
|
*
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
* Note: text set up for tabs at col 16, 22, 41, 49, 57, 65
|
|
|
|
* | | | | | |
|
|
|
|
* ^ ^ ^ ^ ^ ^
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Interfaces defined in this file:
|
|
|
|
*
|
|
|
|
* InitDStack
|
|
|
|
*
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
* dirs built-in 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
|
|
|
*
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
* pushd built-in 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
|
|
|
*
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
* popd built-in 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
|
|
|
*
|
|
|
|
* path2tilde
|
|
|
|
*
|
1998-08-03 17:30:30 +00:00
|
|
|
* getpfxstr
|
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
mcopy /obj/gno/bin/gsh/dir.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
|
|
|
dummydir start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
setcom 60
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
MAXD gequ 50
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Initialize directory stack
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
InitDStack START
|
|
|
|
|
|
|
|
using DirData
|
|
|
|
|
|
|
|
stz tods
|
|
|
|
stz dirstack
|
|
|
|
stz dirstack+2
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
END
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* DIRS: builtin command
|
|
|
|
* syntax: dirs [-l]
|
|
|
|
*
|
|
|
|
* display the directory stack
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
dirs START
|
|
|
|
|
|
|
|
using DirData
|
|
|
|
|
|
|
|
arg equ 0
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ arg+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 showshort
|
|
|
|
dec a
|
|
|
|
bne using
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #4
|
|
|
|
lda [argv],y
|
|
|
|
sta arg
|
|
|
|
ldy #6
|
|
|
|
lda [argv],y
|
|
|
|
sta arg+2
|
|
|
|
lda [arg]
|
|
|
|
and #$FF
|
|
|
|
cmp #'-'
|
|
|
|
bne using
|
|
|
|
ldy #1
|
|
|
|
lda [arg],y
|
|
|
|
cmp #'l'
|
|
|
|
beq showlong
|
|
|
|
|
|
|
|
using ldx #^usingstr
|
|
|
|
lda #usingstr
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra exit
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
showlong jsl dotods Set top of stack to current directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
pea 0
|
|
|
|
jsl showdir
|
|
|
|
bra exit
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
showshort jsl dotods Set top of stack to current directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
pea 1
|
|
|
|
jsl showdir
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit return 2:status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
usingstr dc c'usage: dirs [-l]',h'0d00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* PUSHD: builtin command
|
|
|
|
* syntax: pushd [+n | dir]
|
|
|
|
*
|
|
|
|
* change directory and push
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
pushd START
|
|
|
|
|
|
|
|
using DirData
|
|
|
|
using vardata
|
|
|
|
|
|
|
|
count equ 0
|
|
|
|
p equ count+2
|
|
|
|
arg equ p+4
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ arg+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
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
lda argc Get number of arguments.
|
|
|
|
dec a If no parameters,
|
|
|
|
beq xchange exchange top two dirs on stack.
|
|
|
|
dec a If > 1 parameter,
|
|
|
|
bne usage print usage string.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
ldy #4 Move parameter pointer from
|
|
|
|
lda [argv],y argv array to direct
|
|
|
|
sta arg page variable "arg".
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #6
|
|
|
|
lda [argv],y
|
|
|
|
sta arg+2
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
lda [arg] If first character
|
|
|
|
and #$FF of parameter is
|
|
|
|
cmp #'+' "+",
|
|
|
|
beq rotate do the rotate;
|
|
|
|
jmp godir else push the directory.
|
|
|
|
|
|
|
|
;
|
|
|
|
; More than one parameter provided; print usage string and exit.
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
usage ldx #^usagestr
|
|
|
|
lda #usagestr
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
jmp prerrmsg
|
|
|
|
|
|
|
|
;
|
|
|
|
; Either no parameter or "+" provided; exchange directory stack entries.
|
|
|
|
;
|
|
|
|
xchange lda tods Get index to top of dir stack.
|
|
|
|
bne xgoodie If 0,
|
|
|
|
ldx #^err1 print error message
|
|
|
|
lda #err1 "No other directory"
|
|
|
|
jmp prerrmsg
|
|
|
|
|
|
|
|
xgoodie jsl dotods Set top of stack to current directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda tods
|
|
|
|
dec a
|
|
|
|
asl a
|
|
|
|
asl a
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
tax X = offset to tos-1.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda tods
|
|
|
|
asl a
|
|
|
|
asl a
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
tay Y = offset to tos.
|
|
|
|
lda dirstack,x Swap tos-1 and tos.
|
1997-11-18 05:31:00 +00:00
|
|
|
pha
|
|
|
|
lda dirstack,y
|
|
|
|
sta dirstack,x
|
|
|
|
pla
|
|
|
|
sta dirstack,y
|
|
|
|
lda dirstack+2,x
|
|
|
|
pha
|
|
|
|
lda dirstack+2,y
|
|
|
|
sta dirstack+2,x
|
|
|
|
pla
|
|
|
|
sta dirstack+2,y
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
jmp gototop chdir to the new tos.
|
|
|
|
|
|
|
|
;
|
|
|
|
; Parameter = +n; do the rotate
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
rotate add4 arg,#1,p
|
|
|
|
pei (p+2)
|
|
|
|
pei (p)
|
|
|
|
jsr cstrlen
|
|
|
|
tax
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
Dec2Int (p,@x,#0),@a Convert parameter to decimal
|
|
|
|
sta count and store in count.
|
|
|
|
cmp #0 If parameter is 0
|
|
|
|
beq badnum or negative,
|
|
|
|
bmi badnum report "invalid number".
|
|
|
|
cmp tods If count >= tos,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq rotloop
|
|
|
|
bcc rotloop
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
roterr ldx #^err2 Print error message:
|
|
|
|
lda #err2 Directory stack not that deep
|
|
|
|
jmp prerrmsg
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
badnum ldx #^errbadnum Print error message:
|
|
|
|
lda #errbadnum Invalid number
|
|
|
|
jmp prerrmsg
|
|
|
|
|
|
|
|
;
|
|
|
|
; Loop to rotate entries in directory stack
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
rotloop lda tods
|
|
|
|
dec a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda dirstack+6,y
|
|
|
|
pha
|
|
|
|
lda dirstack+4,y
|
|
|
|
pha
|
|
|
|
rotloop2 lda dirstack,y
|
|
|
|
sta dirstack+4,y
|
|
|
|
lda dirstack+2,y
|
|
|
|
sta dirstack+6,y
|
|
|
|
cpy #0
|
|
|
|
beq nextrot
|
|
|
|
dey
|
|
|
|
dey
|
|
|
|
dey
|
|
|
|
dey
|
|
|
|
bra rotloop2
|
|
|
|
nextrot pla
|
|
|
|
sta dirstack
|
|
|
|
pla
|
|
|
|
sta dirstack+2
|
|
|
|
dec count
|
|
|
|
bne rotloop
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
;
|
|
|
|
; chdir to the top-of-stack directory
|
|
|
|
;
|
|
|
|
gototop lda tods
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda dirstack+2,y
|
|
|
|
pha
|
|
|
|
lda dirstack,y
|
|
|
|
pha
|
|
|
|
jsl gotodir
|
|
|
|
bra done All done.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; Parameter = directory name; add it to the stack
|
|
|
|
;
|
|
|
|
godir anop
|
|
|
|
lda tods
|
|
|
|
cmp #MAXD-1 If index >= maximum,
|
|
|
|
bcc stackok
|
|
|
|
ldx #^errfull print error message.
|
|
|
|
lda #errfull
|
|
|
|
prerrmsg jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
bra exit
|
|
|
|
stackok anop
|
|
|
|
jsl dotods Set top of stack to current directory.
|
1998-09-08 16:53:14 +00:00
|
|
|
pei (arg+2)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (arg)
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
jsl gotodir chdir to the parameter directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
bne exit
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
inc tods Bump the top of stack pointer.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda tods
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda #0
|
|
|
|
sta dirstack,y
|
|
|
|
sta dirstack+2,y
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
jsl dotods Set top of stack to current directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
done lda varpushdsil If $PUSHDSILENT not defined,
|
1997-11-18 05:31:00 +00:00
|
|
|
bne exit
|
|
|
|
pea 1
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
jsl showdir show the directory stack.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit return 2:status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
usagestr dc c'usage: pushd [+n | dir]',h'0d00'
|
|
|
|
err1 dc c'pushd: No other directory',h'0d00'
|
|
|
|
err2 dc c'pushd: Directory stack not that deep',h'0d00'
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
errfull dc c'pushd: Directory stack full',h'0d00'
|
|
|
|
errbadnum dc c'pushd: Invalid number',h'0d00'
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* POPD: builtin command
|
|
|
|
* syntax: popd [+n]
|
|
|
|
*
|
|
|
|
* pop a directory from stack and cd to it
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
popd START
|
|
|
|
|
|
|
|
using DirData
|
|
|
|
using vardata
|
|
|
|
|
|
|
|
count equ 0
|
|
|
|
arg equ count+2
|
1998-12-21 23:57:08 +00:00
|
|
|
status equ arg+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
|
|
|
|
jeq noarg
|
|
|
|
dec a
|
|
|
|
bne using
|
|
|
|
ldy #4
|
|
|
|
lda [argv],y
|
|
|
|
sta arg
|
|
|
|
ldy #6
|
|
|
|
lda [argv],y
|
|
|
|
sta arg+2
|
|
|
|
lda [arg]
|
|
|
|
and #$FF
|
|
|
|
cmp #'+'
|
|
|
|
beq plus
|
|
|
|
|
|
|
|
using ldx #^usingstr
|
|
|
|
lda #usingstr
|
|
|
|
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
|
|
|
|
|
|
|
|
plus add4 arg,#1,arg
|
|
|
|
pei (arg+2)
|
|
|
|
pei (arg)
|
|
|
|
jsr cstrlen
|
|
|
|
tax
|
|
|
|
Dec2Int (arg,@x,#0),@a
|
|
|
|
sta count
|
|
|
|
cmp #0
|
|
|
|
beq noarg
|
|
|
|
lda tods
|
|
|
|
beq pluserr
|
|
|
|
lda count
|
|
|
|
cmp tods
|
|
|
|
beq doplus
|
|
|
|
bcc doplus
|
|
|
|
|
|
|
|
pluserr ldx #^err2
|
|
|
|
lda #err2
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra exit
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
doplus jsl dotods Set top of stack to current directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
sub2 tods,count,@a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tax
|
|
|
|
phx
|
|
|
|
lda dirstack+2,x
|
|
|
|
pha
|
|
|
|
lda dirstack,x
|
|
|
|
pha
|
|
|
|
jsl nullfree
|
|
|
|
plx
|
|
|
|
plusloop lda dirstack+4,x
|
|
|
|
sta dirstack,x
|
|
|
|
lda dirstack+6,x
|
|
|
|
sta dirstack+2,x
|
|
|
|
inx4
|
|
|
|
dec count
|
|
|
|
bne plusloop
|
|
|
|
dec tods
|
|
|
|
|
|
|
|
bra gototop
|
|
|
|
|
|
|
|
noarg lda tods
|
|
|
|
bne noarg0
|
|
|
|
|
|
|
|
ldx #^err1
|
|
|
|
lda #err1
|
|
|
|
jsr errputs
|
1998-12-21 23:57:08 +00:00
|
|
|
inc status Return status = 1.
|
1997-11-18 05:31:00 +00:00
|
|
|
bra exit
|
|
|
|
|
|
|
|
noarg0 lda tods
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda dirstack+2,y
|
|
|
|
pha
|
|
|
|
lda dirstack,y
|
|
|
|
pha
|
|
|
|
jsl nullfree
|
|
|
|
dec tods
|
|
|
|
|
|
|
|
gototop lda tods
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda dirstack+2,y
|
|
|
|
pha
|
|
|
|
lda dirstack,y
|
|
|
|
pha
|
|
|
|
jsl gotodir
|
|
|
|
|
|
|
|
lda varpushdsil
|
|
|
|
bne exit
|
|
|
|
|
|
|
|
pea 1
|
|
|
|
jsl showdir
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
exit return 2:status
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
usingstr dc c'Usage: popd [+n]',h'0d00'
|
|
|
|
err1 dc c'popd: Directory stack empty',h'0d00'
|
|
|
|
err2 dc c'popd: Directory stack not that deep',h'0d00'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Set prefix 0 to the passed c string
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
gotodir PRIVATE
|
|
|
|
|
|
|
|
retval equ 0
|
|
|
|
space equ retval+2
|
|
|
|
|
|
|
|
subroutine (4:dir),space
|
|
|
|
|
|
|
|
stz retval
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
pei (dir+2)
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (dir)
|
|
|
|
jsr c2gsstr
|
|
|
|
sta PRecPath
|
|
|
|
sta GRecPath
|
|
|
|
stx PRecPath+2
|
|
|
|
stx GRecPath+2
|
|
|
|
|
|
|
|
lock mutex
|
|
|
|
|
|
|
|
GetFileInfo GRec
|
|
|
|
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
|
1997-11-18 05:31:00 +00:00
|
|
|
inc retval
|
|
|
|
bra done
|
|
|
|
|
|
|
|
ok if2 GRecFT,eq,#$F,ok2
|
|
|
|
ldx dir+2
|
|
|
|
lda dir
|
|
|
|
jsr errputs
|
|
|
|
ldx #^direrr
|
|
|
|
lda #direrr
|
|
|
|
jsr errputs
|
|
|
|
inc retval
|
|
|
|
bra done
|
|
|
|
|
|
|
|
ok2 SetPrefix PRec
|
|
|
|
bcs ohshit
|
|
|
|
|
|
|
|
done ph4 PRecPath
|
|
|
|
jsl nullfree
|
|
|
|
|
|
|
|
unlock mutex
|
|
|
|
|
|
|
|
return 2:retval
|
|
|
|
|
|
|
|
mutex key
|
|
|
|
|
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
|
|
|
|
PRecNum dc i'0' prefixNum (0 = current directory)
|
|
|
|
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)
|
|
|
|
|
|
|
|
; 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
|
|
|
|
|
|
|
dirErr dc c': Not a directory',h'0d00'
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
END
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Display the directory stack
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
showdir PRIVATE
|
|
|
|
|
|
|
|
using DirData
|
|
|
|
|
|
|
|
idx equ 0
|
|
|
|
space equ idx+2
|
|
|
|
|
|
|
|
subroutine (2:flag),space
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
lda tods Get directory stack index.
|
|
|
|
asl a Multiply by four to
|
|
|
|
asl a get byte offset (idx).
|
1997-11-18 05:31:00 +00:00
|
|
|
sta idx
|
|
|
|
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
loop lda flag If parameter == 1,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq long
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy idx
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
lda dirstack+2,y print entry
|
1997-11-18 05:31:00 +00:00
|
|
|
pha
|
|
|
|
lda dirstack,y
|
|
|
|
pha
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
jsl path2tilde but first substitute "~"
|
|
|
|
phx for home directory.
|
1997-11-18 05:31:00 +00:00
|
|
|
pha
|
|
|
|
jsr puts
|
|
|
|
jsl nullfree
|
1998-09-08 16:53:14 +00:00
|
|
|
bra next
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
|
|
|
|
long ldy idx else,
|
|
|
|
lda dirstack+2,y print full entry.
|
1997-11-18 05:31:00 +00:00
|
|
|
tax
|
|
|
|
lda dirstack,y
|
|
|
|
jsr puts
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
|
|
|
|
next lda #' ' Print a space.
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr putchar
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
|
|
|
|
lda idx If idx != 0,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq done
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
sub2 idx,#4,idx idx = idx -4
|
|
|
|
bra loop handle next entry.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
done jsr newline
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Set the top of the stack to the current directory
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
dotods PRIVATE
|
|
|
|
|
|
|
|
using DIRDATA
|
|
|
|
|
|
|
|
p equ 0
|
|
|
|
idx equ p+4
|
|
|
|
space equ idx+2
|
|
|
|
|
|
|
|
subroutine (0:dummy),space
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
lda tods Get index number.
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
asl a Multiply index by four
|
1998-08-03 17:30:30 +00:00
|
|
|
asl a to get byte offset.
|
|
|
|
sta idx Store in idx
|
|
|
|
tay and Y-register.
|
|
|
|
lda dirstack,y If there is an address
|
|
|
|
ora dirstack+2,y in this position,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq setit
|
|
|
|
|
|
|
|
lda dirstack+2,y
|
|
|
|
pha
|
|
|
|
lda dirstack,y
|
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
jsl nullfree free it.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
setit lock mutex
|
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 p
|
|
|
|
stx p+2
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
ora p+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 [p],y GS/OS string is 0,
|
|
|
|
bne ok an error was reported.
|
|
|
|
|
|
|
|
ph4 p Free the buffer.
|
|
|
|
jsl nullfree
|
|
|
|
|
|
|
|
bra done
|
|
|
|
|
|
|
|
;
|
|
|
|
; Move text in GS/OS result buffer to beginning of buffer
|
|
|
|
; (overwritting the two length words).
|
|
|
|
;
|
|
|
|
ok clc Source is result
|
|
|
|
lda p buffer plus
|
|
|
|
adc #4 four bytes.
|
|
|
|
tay
|
|
|
|
lda p+2
|
|
|
|
adc #0
|
|
|
|
pha
|
|
|
|
phy
|
|
|
|
pei (p+2) Destination is first
|
|
|
|
pei (p) byte of buffer.
|
1998-09-08 16:53:14 +00:00
|
|
|
jsr copycstr
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
ldy idx Store address of string
|
|
|
|
lda p in current position
|
|
|
|
sta dirstack,y of directory stack.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda p+2
|
|
|
|
sta dirstack+2,y
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
done unlock mutex
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
mutex key
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Directory stack data
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
DirData DATA
|
|
|
|
|
|
|
|
dirstack ds MAXD*4
|
|
|
|
tods dc i'0'
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Replace $HOME with a '~' in string
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
path2tilde START
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ptr equ 0
|
|
|
|
newpath equ ptr+4
|
|
|
|
home equ newpath+4
|
|
|
|
space equ home+4
|
|
|
|
|
|
|
|
subroutine (4:path),space
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
pei (path+2) Get length of
|
|
|
|
pei (path) path string
|
|
|
|
jsr cstrlen parameter.
|
|
|
|
inc2 a Add 2, and allocate
|
|
|
|
pea 0 memory for result string.
|
1997-11-18 05:31:00 +00:00
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
~NEW
|
1997-11-18 05:31:00 +00:00
|
|
|
sta newpath
|
|
|
|
stx newpath+2
|
|
|
|
sta ptr
|
|
|
|
stx ptr+2
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
ph4 #homename Get $HOME environment variable.
|
|
|
|
jsl getenv
|
1997-11-18 05:31:00 +00:00
|
|
|
sta home
|
|
|
|
stx home+2
|
1998-08-03 17:30:30 +00:00
|
|
|
ora home+2 If buffer wasn't allocated
|
|
|
|
jeq notfound2 cannot search for $HOME.
|
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
|
|
|
ldy #2 Get result length word.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [home],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
|
|
|
beq notfound2 If 0, just copy the rest.
|
|
|
|
tax Use X to count down HOME chars.
|
|
|
|
ldy #0 path index is based from 0.
|
1998-09-08 16:53:14 +00:00
|
|
|
checkhome lda [path],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
|
|
|
and #$FF Isolate character in parameter,
|
|
|
|
beq notfound2 checking for end of string,
|
|
|
|
jsr tolower converting to lower-case
|
|
|
|
jsr toslash and changing ":" to "/".
|
1998-08-03 17:30:30 +00:00
|
|
|
pha Hold on stack for comparison.
|
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
|
|
|
iny4 $home has 4 bytes of length info
|
|
|
|
lda [home],y that need to be indexed over.
|
|
|
|
dey2 Take back 3 of the offset,
|
|
|
|
dey nudging Y ahead by 1.
|
|
|
|
and #$FF Isolate $home character,
|
|
|
|
jsr tolower converting to lower-case
|
|
|
|
jsr toslash and changing ":" to "/".
|
|
|
|
cmp 1,s If the parameter character !=,
|
|
|
|
bne notfound there is no match.
|
|
|
|
pla Pop the parameter character off stack.
|
|
|
|
dex Decrement $home length counter.
|
1998-09-08 16:53:14 +00:00
|
|
|
bne checkhome If more, stay in loop.
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; First part of parameter matched $HOME
|
|
|
|
;
|
|
|
|
cmp #'/' This char = "/"?
|
|
|
|
beq found yes -- it's a match.
|
1998-09-08 16:53:14 +00:00
|
|
|
lda [path],y If the following character
|
1998-08-03 17:30:30 +00:00
|
|
|
and #$FF is zero (end of string),
|
1997-11-18 05:31:00 +00:00
|
|
|
beq found
|
1998-08-03 17:30:30 +00:00
|
|
|
jsr toslash '/', or ':', we have a match.
|
1997-11-18 05:31:00 +00:00
|
|
|
cmp #'/'
|
|
|
|
bne notfound2
|
1998-08-03 17:30:30 +00:00
|
|
|
found lda #'~' Store '~' as first character
|
|
|
|
sta [ptr] in result buffer, and bump
|
|
|
|
incad ptr result pointer.
|
1998-09-08 16:53:14 +00:00
|
|
|
bra copyrest
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; First part of parameter does not match $HOME
|
|
|
|
;
|
|
|
|
notfound pla Get rid of comparison value on stack.
|
1998-09-08 16:53:14 +00:00
|
|
|
notfound2 ldy #0 Not found: copy from beginning.
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; Copy remainder of parameter (Y-reg marks start) to destination string
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
copyrest short a
|
|
|
|
copyloop lda [path],y
|
|
|
|
beq endcopy
|
|
|
|
cmp #':'
|
|
|
|
bne copyput
|
|
|
|
lda #'/'
|
1998-09-08 16:53:14 +00:00
|
|
|
copyput sta [ptr]
|
1997-11-18 05:31:00 +00:00
|
|
|
long a
|
1998-07-20 16:23:11 +00:00
|
|
|
incad ptr
|
1997-11-18 05:31:00 +00:00
|
|
|
short a
|
|
|
|
iny
|
|
|
|
bra copyloop
|
1998-09-08 16:53:14 +00:00
|
|
|
endcopy sta [ptr]
|
1997-11-18 05:31:00 +00:00
|
|
|
long a
|
1998-08-03 17:30:30 +00:00
|
|
|
dec ptr If final character
|
|
|
|
lda [ptr] was "/",
|
1997-11-18 05:31:00 +00:00
|
|
|
cmp #'/'
|
|
|
|
bne skipshorten
|
1998-08-03 17:30:30 +00:00
|
|
|
lda #0 obliterate it.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta [ptr]
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
skipshorten pei (home+2) Free memory allocated
|
|
|
|
pei (home) for the value of $HOME.
|
|
|
|
jsl nullfree
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
return 4:newpath
|
|
|
|
|
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
|
|
|
homename gsstr 'home' Env variable name
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Return pointer to current directory (\0) GS/OS string in a/x
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
getpfxstr START
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
p equ 0
|
|
|
|
space equ p+4
|
|
|
|
|
|
|
|
subroutine (2:pnum),space
|
|
|
|
|
|
|
|
lock mutex
|
|
|
|
|
|
|
|
; Use dummy GS/OS result buf to get length of pathname
|
|
|
|
;
|
|
|
|
lda pnum Put prefix num into
|
|
|
|
cmp #$FFFF If it's $FFFF,
|
|
|
|
beq doboot use GetBootVol, not GetPrefix.
|
|
|
|
|
|
|
|
sta gpnum Store prefix num in parameter block.
|
1998-09-08 16:53:14 +00:00
|
|
|
ld4 TempResultBuf,gppath
|
1998-08-03 17:30:30 +00:00
|
|
|
GetPrefix gpparm
|
|
|
|
bra chklen
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
doboot ld4 TempResultBuf,gbpath
|
1998-08-03 17:30:30 +00:00
|
|
|
GetBootVol gbparm
|
|
|
|
|
|
|
|
chklen lda TempRBlen Use that length
|
|
|
|
clc plus five (for
|
|
|
|
adc #5 len words and terminator)
|
|
|
|
pea 0 to allocate memory
|
|
|
|
pha that holds the string.
|
|
|
|
~NEW
|
|
|
|
sta p Store result in
|
|
|
|
stx p+2 direct page pointer.
|
|
|
|
|
|
|
|
ora p+2 If memory was not available,
|
|
|
|
bne memok
|
|
|
|
lda #0201 report memory error and
|
|
|
|
bra rpterr return NULL to user.
|
|
|
|
|
|
|
|
|
|
|
|
memok lda TempRBlen Store result buf
|
|
|
|
inc2 a length at start
|
|
|
|
inc2 a of buffer.
|
|
|
|
sta [p]
|
|
|
|
|
|
|
|
tay Store a null byte
|
|
|
|
short a at the end of the
|
|
|
|
lda #0 string so it can
|
|
|
|
sta [p],y be used as a c-string.
|
|
|
|
long a
|
|
|
|
;
|
|
|
|
; Get the prefix string into the newly allocated buffer.
|
|
|
|
;
|
|
|
|
lda pnum Prefix number tells
|
|
|
|
cmp #$FFFF whether to use
|
|
|
|
beq doboot2 GetPrefix or GetBootVol.
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
mv4 p,gppath
|
1998-08-03 17:30:30 +00:00
|
|
|
GetPrefix gpparm
|
|
|
|
bcs rpterr
|
|
|
|
bra done
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
doboot2 mv4 p,gbpath
|
1998-08-03 17:30:30 +00:00
|
|
|
GetBootVol gbparm
|
|
|
|
bcc done If there was an error,
|
|
|
|
|
|
|
|
rpterr sta errError Save the value
|
|
|
|
ErrorGS err and report it.
|
|
|
|
ldy #2 Set length of returned
|
|
|
|
lda #0 string to 0 so caller
|
|
|
|
sta [p],y can detect error condition.
|
|
|
|
|
|
|
|
done unlock mutex
|
|
|
|
|
|
|
|
;
|
|
|
|
; Return pointer to caller. (Caller has responsibility to deallocate.)
|
|
|
|
;
|
|
|
|
return 4:p
|
|
|
|
|
|
|
|
mutex key
|
|
|
|
|
|
|
|
;
|
|
|
|
; Parameter block for GetPrefix GS/OS call
|
|
|
|
;
|
|
|
|
gpparm dc i2'2' pCount
|
|
|
|
gpnum dc i2'0' prefixNum (from parameter)
|
|
|
|
gppath dc i4'0' prefix returned to this GS/OS buffer.
|
|
|
|
|
|
|
|
;
|
|
|
|
; Parameter block for GetBootVol GS/OS call
|
|
|
|
;
|
|
|
|
gbparm dc i2'1' pCount
|
|
|
|
gbpath dc i4'0' prefix returned to this GS/OS buffer.
|
|
|
|
|
|
|
|
;
|
|
|
|
; GS/OS result buffer for getting the full length of the prefix string
|
|
|
|
;
|
|
|
|
TempResultBuf dc i2'5' Only five bytes total.
|
|
|
|
TempRBlen ds 2 String's length returned here.
|
|
|
|
ds 1 Only 1 byte for value.
|
|
|
|
|
|
|
|
;
|
|
|
|
; Parameter block for shell ErrorGS call (p 393 in ORCA/M manual)
|
|
|
|
;
|
|
|
|
err dc i2'1' pCount
|
|
|
|
errError ds 2 Error number
|
|
|
|
|
|
|
|
END
|