fix bonus rule and fix error in write and read (returned -1 instead of 0)

This commit is contained in:
2025-08-06 14:29:40 +02:00
parent e6c4b33fc1
commit 49501469c8
3 changed files with 6 additions and 8 deletions

View File

@ -3,7 +3,6 @@ NAME ?= libasm.a
SRCS_DIR = srcs
SRCS_BONUS_DIR = srcs/bonus
OBJS_DIR = .objs
SRCS_NAMES = ft_strlen.s\
ft_strcpy.s\
ft_strcmp.s\
@ -27,13 +26,13 @@ FLAGS = -felf64
all: $(NAME)
libasm_bonus.a : $(OBJS_DIR) $(OBJS) $(OBJS_BONUS)
ar rcs libasm_bonus.a $(OBJS) $(OBJS_BONUS)
test: test.c libasm_bonus.a
test: test.c bonus
clang -z noexecstack test.c -L. -lasm_bonus -o test -g
./test || echo -e "\033[31m tests exited with an error code"
bonus: $(OBJS_DIR) $(OBJS) $(OBJS_BONUS)
ar rcs $@ $(OBJS) $(OBJS_BONUS)
$(NAME): $(OBJS_DIR) $(OBJS)
ar rcs $@ $(OBJS)
@ -51,6 +50,5 @@ clean:
fclean: clean
rm -f $(NAME) test
rm -f libasm_bonus.a
.PHONY: fclean clean all

View File

@ -7,7 +7,7 @@ ft_read:
syscall
cmp rax, 0 ; if return is < 0, it's an error in negative
jg success
jge success
neg rax ; inv errno, and set errno
mov edi, eax

View File

@ -7,7 +7,7 @@ ft_write:
syscall
cmp rax, 0 ; if return is < 0, it's an error in negative
jg success
jge success
neg rax ; inv errno, and set errno
mov edi, eax