summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfaissaloo <faissaloo@gmail.com>2016-07-28 12:18:16 +0100
committerfaissaloo <faissaloo@gmail.com>2016-07-28 12:18:16 +0100
commit7618a44fd16275445b9dc062f4ac50b8d0ff129f (patch)
tree5df3f00bf93126f2daebde40f2389ffe9a05f145
parent6cc41e91a21660769a0fba1b591dbf1cfe97b922 (diff)
downloaddbsh-7618a44fd16275445b9dc062f4ac50b8d0ff129f.tar.gz
Added support for /etc/environments that have no speech marks
-rw-r--r--environment1
-rwxr-xr-xshbin1648 -> 1664 bytes
-rw-r--r--sh.asm24
3 files changed, 17 insertions, 8 deletions
diff --git a/environment b/environment
new file mode 100644
index 0000000..8232286
--- /dev/null
+++ b/environment
@@ -0,0 +1 @@
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
diff --git a/sh b/sh
index fb20e3e..eda9e13 100755
--- a/sh
+++ b/sh
Binary files differ
diff --git a/sh.asm b/sh.asm
index 638614d..369157f 100644
--- a/sh.asm
+++ b/sh.asm
@@ -91,20 +91,22 @@ _start:
dec r8
; Reads the PATH variable
- mov r10, `\0\0PATH="`
+ mov r10, `\0\0\0PATH=`
_pathfinder:
inc r8
;Check that we've found the PATH variable
mov rax, [r8]
- shl rax, 16
- cmp rax,r10
+ shl rax, 24
+ cmp rax, r10
jne _pathfinder ;if we haven't, let's move right one and see if it's there
- shr rax, 56
- test al, al ;checks for a null terminator after 'PATH='
+ cmp byte [r8], `"`
+ jne _pathfinder_continue
+ inc r8
+ cmp byte [r8], 0
jz _quit
-
- add r8, 0x6
+ _pathfinder_continue:
+ add r8, 0x5
mov r10, 0x1
push 0x0
push r8
@@ -116,7 +118,13 @@ _start:
cmp al, `:`
je _pathender1
cmp al, `"`
- jne _pathender
+ je _pathender_exit
+ cmp al, `\n`
+ je _pathender_exit
+ cmp al, 0
+ jz _pathender_exit
+ jmp _pathender
+ _pathender_exit:
mov byte [r8], 0x0
mov r9, rsp
jmp _read_loop