diff --git a/ka/usr/cmd-exec.k b/ka/usr/cmd-exec.k index 6cac8d9..ee0afdd 100644 --- a/ka/usr/cmd-exec.k +++ b/ka/usr/cmd-exec.k @@ -11,21 +11,25 @@ blte zero, eax, .do_exec ; nope, append ".com" and try again + mov esi, argv0 sub ecx, argbuf.size, 5 - scasb ax0, zero ; find null-term - mov b[ax0+0], '.' ; ".com" - mov b[ax0+1], 'c' - mov b[ax0+2], 'o' - mov b[ax0+3], 'm' - nul b[ax0+4] + scasb esi, zero ; find null-term + mov b[esi], '.' ; ".com" + mov b[esi+1], 'c' + mov b[esi+2], 'o' + mov b[esi+3], 'm' + nul b[esi+4] ; try again mov eax, Sys.OpenFile mov ax0, argv0 trap 0 - ; still no good? - bltz eax, .exec_not_found + ; we good? + blte 0, eax, .do_exec + + nul b[esi] ; erase ".com" + jmp .exec_not_found .do_exec: ; load file into memory diff --git a/vm/ob/command.k b/vm/ob/command.k index a5683a0..29f5544 100644 --- a/vm/ob/command.k +++ b/vm/ob/command.k @@ -1380,21 +1380,25 @@ main: blte zero, eax, .do_exec ; nope, append ".com" and try again + mov esi, argv0 sub ecx, argbuf.size, 5 - scasb ax0, zero ; find null-term - mov b[ax0+0], '.' ; ".com" - mov b[ax0+1], 'c' - mov b[ax0+2], 'o' - mov b[ax0+3], 'm' - nul b[ax0+4] + scasb esi, zero ; find null-term + mov b[esi], '.' ; ".com" + mov b[esi+1], 'c' + mov b[esi+2], 'o' + mov b[esi+3], 'm' + nul b[esi+4] ; try again mov eax, Sys.OpenFile mov ax0, argv0 trap 0 - ; still no good? - bltz eax, .exec_not_found + ; we good? + blte 0, eax, .do_exec + + nul b[esi] ; erase ".com" + jmp .exec_not_found .do_exec: ; load file into memory