Error handler, makefile optimisation
This commit is contained in:
parent
0bd9f11f6f
commit
dc6d943e5c
@ -1,9 +1,11 @@
|
|||||||
all: main
|
all: main
|
||||||
|
|
||||||
main: ../../std.o
|
main: ../../std.o main.o
|
||||||
fasm main.asm
|
|
||||||
ld -m elf_i386 main.o ../../std.o --output main
|
ld -m elf_i386 main.o ../../std.o --output main
|
||||||
|
|
||||||
|
main.o:
|
||||||
|
fasm main.asm
|
||||||
|
|
||||||
../../std.o:
|
../../std.o:
|
||||||
make -C ../../ std.o
|
make -C ../../ std.o
|
||||||
|
|
||||||
|
Binary file not shown.
@ -8,9 +8,14 @@ extrn print.str
|
|||||||
extrn print.nl
|
extrn print.nl
|
||||||
extrn exit
|
extrn exit
|
||||||
|
|
||||||
|
macro nl {
|
||||||
|
call print.nl
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
section '.strtab'
|
section '.strtab'
|
||||||
filename db "makefile", 0
|
filename db "makefile", 0
|
||||||
|
error db "An error occurred while opening the file", 0
|
||||||
|
|
||||||
|
|
||||||
section '.bss' writeable
|
section '.bss' writeable
|
||||||
@ -22,17 +27,26 @@ _start:
|
|||||||
push filename
|
push filename
|
||||||
call file.open
|
call file.open
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
|
cmp eax, 0
|
||||||
|
jne @f
|
||||||
|
push error
|
||||||
|
call print.str
|
||||||
|
nl
|
||||||
|
call exit
|
||||||
|
|
||||||
|
@@:
|
||||||
mov [file_], eax
|
mov [file_], eax
|
||||||
|
|
||||||
push dword [file_]
|
push dword [file_]
|
||||||
call print.str
|
call print.str
|
||||||
call print.nl
|
nl
|
||||||
call print.nl
|
nl
|
||||||
|
|
||||||
push dword [file_]
|
push dword [file_]
|
||||||
call file.content
|
call file.content
|
||||||
call print.str
|
call print.str
|
||||||
call print.nl
|
nl
|
||||||
|
|
||||||
push dword [file_]
|
push dword [file_]
|
||||||
call file.close
|
call file.close
|
||||||
|
Binary file not shown.
@ -1,8 +1,10 @@
|
|||||||
all: main
|
all: main
|
||||||
|
|
||||||
main: ../../file.o ../../std.o ../../path.o ../../string.o
|
main: ../../file.o ../../std.o ../../path.o ../../string.o main.o
|
||||||
|
ld -m elf_i386 main.o ../../file.o ../../std.o ../../path.o ../../string.o --output main
|
||||||
|
|
||||||
|
main.o:
|
||||||
fasm main.asm
|
fasm main.asm
|
||||||
ld -m elf_i386 main.o ../../file.o ../../std.o ../../path.o --output main
|
|
||||||
|
|
||||||
../../std.o:
|
../../std.o:
|
||||||
make -C ../.. std.o
|
make -C ../.. std.o
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
all: main
|
all: main
|
||||||
|
|
||||||
main: ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o
|
main: ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o main.o
|
||||||
fasm main.asm
|
|
||||||
ld -m elf_i386 main.o ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o --output main
|
ld -m elf_i386 main.o ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o --output main
|
||||||
|
|
||||||
|
main.o:
|
||||||
|
fasm main.asm
|
||||||
|
|
||||||
../../std.o:
|
../../std.o:
|
||||||
make -C ../.. std.o
|
make -C ../.. std.o
|
||||||
|
|
||||||
@ -21,4 +23,3 @@ main: ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o
|
|||||||
|
|
||||||
clear:
|
clear:
|
||||||
rm main.o main
|
rm main.o main
|
||||||
|
|
||||||
|
@ -34,6 +34,13 @@ open:
|
|||||||
mov edx, O_DIRECTORY
|
mov edx, O_DIRECTORY
|
||||||
int 80h
|
int 80h
|
||||||
|
|
||||||
|
cmp eax, -2
|
||||||
|
jne @f
|
||||||
|
mov [ebp+2*4], dword 0
|
||||||
|
postlude
|
||||||
|
ret
|
||||||
|
|
||||||
|
@@:
|
||||||
mov [fd], eax
|
mov [fd], eax
|
||||||
|
|
||||||
; fstat
|
; fstat
|
||||||
|
Reference in New Issue
Block a user