From: Robert Pengelly Date: Sun, 29 Sep 2024 15:27:04 +0000 (+0100) Subject: Hand && in command line X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=cccbbddf0aac72383004ed22485c378e25c29afd;p=chimaera.git Hand && in command line --- diff --git a/build/chimaera.img b/build/chimaera.img index 2c9457a..a57cbef 100644 Binary files a/build/chimaera.img and b/build/chimaera.img differ diff --git a/build/chimaera.vhd b/build/chimaera.vhd index 1e70211..6fde73c 100644 Binary files a/build/chimaera.vhd and b/build/chimaera.vhd differ diff --git a/src/Makefile.unix b/src/Makefile.unix index 6377e4f..3c68507 100644 --- a/src/Makefile.unix +++ b/src/Makefile.unix @@ -29,7 +29,7 @@ chimaera.img: all echo set PATH=A:\\DOS >> autoexec.bat # echo '%PATH%\\temp.bat' >> autoexec.bat # echo echo 123 >> temp.bat -# echo echo %PATH% >> temp.bat +# echo 'echo %PATH% && echo 123' >> temp.bat # echo temp >> temp.bat utils/dosfstools/mkdosfs --boot boot/freeldr/bootsect/fat12.bin --sectors 720 -F 12 -n "CHIMAERA OS" $@ diff --git a/src/apps/pcomm/list.asm b/src/apps/pcomm/list.asm index 4afa475..99e82ff 100644 --- a/src/apps/pcomm/list.asm +++ b/src/apps/pcomm/list.asm @@ -25,7 +25,7 @@ _list_push: push es push ds - mov ax, 4 + mov ax, 6 xor dx, dx push ax @@ -39,6 +39,9 @@ _list_push: xor bx, bx + mov ax, word ptr [bp + 8] + mov es:[bx + 2], ax + mov ax, word ptr [bp + 6] mov es:[bx], ax @@ -67,13 +70,13 @@ _list_push.got_head: _list_push.search: mov es, ax - mov ax, es:[bx + 2] + mov ax, es:[bx + 4] and ax, ax jnz _list_push.search mov dx, word ptr [bp - 2] - mov es:[bx + 2], dx + mov es:[bx + 4], dx _list_push.done: diff --git a/src/apps/pcomm/pcomm.asm b/src/apps/pcomm/pcomm.asm index ef84c04..f1b5362 100644 --- a/src/apps/pcomm/pcomm.asm +++ b/src/apps/pcomm/pcomm.asm @@ -56,20 +56,21 @@ _main: and cx, cx jz .L109 + +.L125: + + mov dx, 1 + push dx mov ax, es:[di] - - push ds push ax mov ax, offset _scratch_list push ax call _list_push - add sp, 2 + add sp, 6 - pop ax - pop ds add di, 2 dec cx @@ -136,6 +137,9 @@ _main: cmp word ptr cs:[_echo_line], 0 je .L115 + cmp word ptr es:[di + 2], 0 + je .L115 + call _writestr call _crlf @@ -154,7 +158,7 @@ _main: pop di pop ds - mov ax, word ptr es:[di + 2] + mov ax, word ptr es:[di + 4] push es call _free @@ -1950,7 +1954,7 @@ _get_command: push dx mov word ptr [bp - 2], 0 - mov si, offset _formatted_command + mov si, word ptr [bp + 4] _get_command.loop: @@ -2003,7 +2007,10 @@ _get_command.null: _get_command.done: - mov bx, word ptr [bp - 2] + mov ax, word ptr [bp - 2] + + and ax, ax + jnz _get_command.external pop dx pop ax @@ -2012,16 +2019,23 @@ _get_command.done: add sp, 2 clc + mov bx, word ptr [bp + 4] pop bp - and bx, bx - jz _get_command.ret - - stc + ret -_get_command.ret: +_get_command.external: - mov bx, offset _formatted_command + pop dx + pop ax + pop si + + add sp, 2 + stc + + mov bx, word ptr [bp + 4] + pop bp + ret ;****************************************************************************** @@ -2329,6 +2343,16 @@ _process_line: mov ax, cs mov es, ax + + mov bx, word ptr [bp + 4] + +.L121: + + cmp byte ptr [bx], ' ' + jne .L102 + + inc bx + jmp .L121 .L102: @@ -2340,7 +2364,6 @@ _process_line: mov cx, 255 rep stosb - mov bx, word ptr [bp + 4] push bx call _expand_vars @@ -2348,8 +2371,85 @@ _process_line: mov ax, cs mov ds, ax + +.L124: + + mov ax, '&' + push ax + + mov si, offset _formatted_command + push si + + call _strchr + add sp, 4 + + and ax, ax + jz .L120 + + mov di, ax + + xor al, al + stosb + + cmp byte ptr [di], '&' + jne .L120 + + stosb + +.L122: + + cmp byte ptr [di], ' ' + jne .L123 + + inc di + jmp .L122 + +.L123: + + push es + push di + + call _strlen + add sp, 2 + + xor dx, dx + inc ax + + push ax + push dx + + call _xmalloc + add sp, 4 + + xor dx, dx + push dx + + mov es, ax + push es + + mov ax, offset _scratch_list + push ax + + call _list_push + add sp, 6 + + push di + + xor ax, ax + push ax + + call _strcpy + add sp, 4 + + pop es + +.L120: + + push si call _get_command + add sp, 2 + jc .L23 mov si, bx @@ -2946,6 +3046,8 @@ _read_batch.check: _read_batch.next: + inc word ptr cs:[_in_batch] + pop ds pop bx pop ax