Skip to content

Commit

Permalink
Bug fix mlibc for lua
Browse files Browse the repository at this point in the history
  • Loading branch information
konect-V committed Aug 29, 2024
1 parent 69896d3 commit bbc6f5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
20 changes: 4 additions & 16 deletions sources/core/apps/lua/target/amd64/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,11 @@ CFLAGS = -Werror
LDFLAGS = -Wall \
-lc

# Recursive Wild Card
rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))

# Source Files
C_SRC = $(call rwildcard,$(SOURCE),*.c)

OBJS = $(patsubst $(SOURCE)/%.c,$(LIB)/%_c.o,$(C_SRC))

# Target
$(LIB)/%_c.o: $(SOURCE)/%.c
@ mkdir -m 777 -p $(@D)
@ $(call cyan,"$(subst ../,,$^)")
@ $(CC) $(CFLAGS) -c $^ -o $@

git:
@ rm -rf $(SOURCE)
@ cd $(HOME) && git clone https://github.com/kot-org/lua source
@ if [ ! -d $(SOURCE) ]; then \
rm -rf $(SOURCE); \
cd $(HOME) && git clone https://github.com/kot-org/lua source; \
fi

compile:
@ cd $(SOURCE) && make all
Expand Down
5 changes: 4 additions & 1 deletion sources/core/libs/mlibc/options/ansi/generic/stdio-stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,10 @@ char *fgets_unlocked(char *__restrict buffer, size_t max_size, FILE *stream) {
// In this case, the buffer is not changed.
return nullptr;
}
} else {
} else if (c == '\b') {
buffer[i - 1] = 0;
i -= 2;
} else {
buffer[i] = c;
}

Expand Down

0 comments on commit bbc6f5b

Please sign in to comment.