diff options
| author | faissaloo <faissaloo@gmail.com> | 2016-07-28 12:18:16 +0100 |
|---|---|---|
| committer | faissaloo <faissaloo@gmail.com> | 2016-07-28 12:18:16 +0100 |
| commit | 7618a44fd16275445b9dc062f4ac50b8d0ff129f (patch) | |
| tree | 5df3f00bf93126f2daebde40f2389ffe9a05f145 /sh.asm | |
| parent | 6cc41e91a21660769a0fba1b591dbf1cfe97b922 (diff) | |
| download | dbsh-7618a44fd16275445b9dc062f4ac50b8d0ff129f.tar.gz | |
Added support for /etc/environments that have no speech marks
Diffstat (limited to 'sh.asm')
| -rw-r--r-- | sh.asm | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -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 |
