update: fixed some function leaking into the final binary...
This commit is contained in:
parent
f82a4041a5
commit
a905a595d4
7 changed files with 22 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -72,3 +72,4 @@ parser/split_rust
|
||||||
.tree-sitter-sh/src/tree_sitter/
|
.tree-sitter-sh/src/tree_sitter/
|
||||||
.tree-sitter-sh/src/node-types.json
|
.tree-sitter-sh/src/node-types.json
|
||||||
.direnv
|
.direnv
|
||||||
|
minishell_bonus
|
||||||
|
|
|
||||||
14
Makefile
14
Makefile
|
|
@ -6,7 +6,7 @@
|
||||||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||||
# Updated: 2024/09/26 18:01:37 by maiboyer ### ########.fr #
|
# Updated: 2024/10/06 14:58:13 by maiboyer ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -35,11 +35,11 @@ PMAKE =
|
||||||
ifndef PMAKE_DISABLE
|
ifndef PMAKE_DISABLE
|
||||||
ifeq ($(shell uname), Linux)
|
ifeq ($(shell uname), Linux)
|
||||||
PMAKE = -j$(shell grep -c ^processor /proc/cpuinfo)
|
PMAKE = -j$(shell grep -c ^processor /proc/cpuinfo)
|
||||||
CFLAGS_ADDITIONAL += -DPRINT_BACKTRACE
|
#CFLAGS_ADDITIONAL += -DPRINT_BACKTRACE
|
||||||
endif
|
endif
|
||||||
ifeq ($(shell uname), Darwin)
|
ifeq ($(shell uname), Darwin)
|
||||||
PMAKE = -j$(shell sysctl -n hw.ncpu)
|
PMAKE = -j$(shell sysctl -n hw.ncpu)
|
||||||
CFLAGS_ADDITIONAL += -DNVALGRIND
|
#CFLAGS_ADDITIONAL += -DNVALGRIND
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -49,12 +49,12 @@ endif
|
||||||
# TODO: REMOVE THIS WHEN FINISHING THIS:
|
# TODO: REMOVE THIS WHEN FINISHING THIS:
|
||||||
# CFLAGS_ADDITIONAL += -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins #-fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--allow-multiple
|
# CFLAGS_ADDITIONAL += -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins #-fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--allow-multiple
|
||||||
# CFLAGS_ADDITIONAL += -O0
|
# CFLAGS_ADDITIONAL += -O0
|
||||||
CFLAGS_ADDITIONAL += -Wno-cpp -Wno-type-limits -Wno-unused-command-line-argument
|
# CFLAGS_ADDITIONAL += -Wno-cpp -Wno-type-limits -Wno-unused-command-line-argument
|
||||||
CFLAGS_ADDITIONAL += -gcolumn-info -g3
|
CFLAGS_ADDITIONAL += -gcolumn-info -g3 -fno-builtin
|
||||||
CFLAGS_ADDITIONAL += '-DERROR=((void)printf("ERROR HERE: " __FILE__ ":%d in %s\n", __LINE__, __func__), 1)'
|
# CFLAGS_ADDITIONAL += '-DERROR=((void)printf("ERROR HERE: " __FILE__ ":%d in %s\n", __LINE__, __func__), 1)'
|
||||||
# CFLAGS_ADDITIONAL += -O2
|
# CFLAGS_ADDITIONAL += -O2
|
||||||
# CFLAGS_ADDITIONAL += -fuse-ld=gold -Wl,--print-symbol-counts -Wl,/tmp/symbols_count.log
|
# CFLAGS_ADDITIONAL += -fuse-ld=gold -Wl,--print-symbol-counts -Wl,/tmp/symbols_count.log
|
||||||
# CFLAGS_ADDITIONAL += -fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-O3 -Wl,--allow-multiple
|
CFLAGS_ADDITIONAL += -fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-O3
|
||||||
# CFLAGS_ADDITIONAL += -I$(shell realpath ./includes) -I$(shell realpath ./output/include)
|
# CFLAGS_ADDITIONAL += -I$(shell realpath ./includes) -I$(shell realpath ./output/include)
|
||||||
|
|
||||||
export CFLAGS_ADDITIONAL
|
export CFLAGS_ADDITIONAL
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/04/28 17:28:30 by maiboyer #+# #+# #
|
# Created: 2024/04/28 17:28:30 by maiboyer #+# #+# #
|
||||||
# Updated: 2024/10/06 14:33:24 by maiboyer ### ########.fr #
|
# Updated: 2024/10/06 14:42:55 by maiboyer ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -17,6 +17,7 @@ link_group = -Wl,--start-group $(1) -Wl,--end-group
|
||||||
# Variables
|
# Variables
|
||||||
ANAME = sh
|
ANAME = sh
|
||||||
BUILD_DIR ?= $(shell realpath ./build/)
|
BUILD_DIR ?= $(shell realpath ./build/)
|
||||||
|
NAME = minishell
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS), bonus)
|
ifeq ($(MAKECMDGOALS), bonus)
|
||||||
CFLAGS_ADDITIONAL += -DBONUS=1
|
CFLAGS_ADDITIONAL += -DBONUS=1
|
||||||
|
|
@ -42,7 +43,6 @@ GEN_DIR = output
|
||||||
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES)))
|
SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES)))
|
||||||
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
|
OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
|
||||||
DEP = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
|
DEP = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES)))
|
||||||
NAME = minishell
|
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
CC ?= clang
|
CC ?= clang
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/30 16:17:17 by rparodi #+# #+# */
|
/* Created: 2024/07/30 16:17:17 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/08/05 15:19:17 by maiboyer ### ########.fr */
|
/* Updated: 2024/10/06 15:05:48 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -82,6 +82,7 @@ t_error write_fd(t_fd *fd, t_u8 *buffer, t_usize size, t_isize *write_count)
|
||||||
return (NO_ERROR);
|
return (NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: REMOVE THIS COMMENT SURROUNDING THE FUNCTION
|
||||||
t_error stat_fd(t_fd *fd, t_stat *stat)
|
t_error stat_fd(t_fd *fd, t_stat *stat)
|
||||||
{
|
{
|
||||||
if (fd == NULL || stat == NULL || fd->fd == -1)
|
if (fd == NULL || stat == NULL || fd->fd == -1)
|
||||||
|
|
@ -90,6 +91,7 @@ t_error stat_fd(t_fd *fd, t_stat *stat)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
return (NO_ERROR);
|
return (NO_ERROR);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void close_fd(t_fd *fd)
|
void close_fd(t_fd *fd)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/30 16:26:32 by rparodi #+# #+# */
|
/* Created: 2024/07/30 16:26:32 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/08/05 15:19:21 by maiboyer ### ########.fr */
|
/* Updated: 2024/10/06 15:05:57 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
/* TODO: REMOVE THIS COMMENT SURROUNDING THE FUNCTION
|
||||||
t_error open_file(t_str name, t_mode mode, t_file **file)
|
t_error open_file(t_str name, t_mode mode, t_file **file)
|
||||||
{
|
{
|
||||||
t_file *out;
|
t_file *out;
|
||||||
|
|
@ -82,3 +83,4 @@ void close_file(t_file *file)
|
||||||
mem_set_zero(slot, sizeof(*slot));
|
mem_set_zero(slot, sizeof(*slot));
|
||||||
slot->ty = SLOT_UNUSED;
|
slot->ty = SLOT_UNUSED;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/05/19 15:53:50 by maiboyer #+# #+# */
|
/* Created: 2024/05/19 15:53:50 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/08/22 16:23:04 by maiboyer ### ########.fr */
|
/* Updated: 2024/10/06 15:02:50 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -57,6 +57,9 @@ __attribute__((destructor(201))) void close_all_slots(void)
|
||||||
close_slot(&arr->storage[i++]);
|
close_slot(&arr->storage[i++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is to remove the f<name> function from being there...
|
||||||
|
// else if (slot->ty == SLOT_FILE)
|
||||||
|
// ;//close_file(&slot->slot.file);
|
||||||
void close_slot(struct s_file_slot *slot)
|
void close_slot(struct s_file_slot *slot)
|
||||||
{
|
{
|
||||||
if (slot == NULL)
|
if (slot == NULL)
|
||||||
|
|
@ -67,8 +70,6 @@ void close_slot(struct s_file_slot *slot)
|
||||||
close_fd(&slot->slot.fd);
|
close_fd(&slot->slot.fd);
|
||||||
else if (slot->ty == SLOT_DIR)
|
else if (slot->ty == SLOT_DIR)
|
||||||
close_dir(&slot->slot.dir);
|
close_dir(&slot->slot.dir);
|
||||||
else if (slot->ty == SLOT_FILE)
|
|
||||||
close_file(&slot->slot.file);
|
|
||||||
else
|
else
|
||||||
(void)!write(2, "Unknown SLOT type", 17);
|
(void)!write(2, "Unknown SLOT type", 17);
|
||||||
mem_set_zero(slot, sizeof(*slot));
|
mem_set_zero(slot, sizeof(*slot));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/16 17:57:04 by maiboyer #+# #+# */
|
/* Created: 2023/11/16 17:57:04 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/07/30 16:10:07 by rparodi ### ########.fr */
|
/* Updated: 2024/10/06 15:04:47 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ bool handle_atoi_stuff(t_const_str fmt, t_usize *c_idx, t_usize *nxt,
|
||||||
advance_atoi(fmt, c_idx);
|
advance_atoi(fmt, c_idx);
|
||||||
c_arg->extra.align = (t_u64)atoi_res;
|
c_arg->extra.align = (t_u64)atoi_res;
|
||||||
handle_prec_and_align(fmt, c_idx, c_arg);
|
handle_prec_and_align(fmt, c_idx, c_arg);
|
||||||
atoi_res = atoi(&fmt[*c_idx]);
|
atoi_res = _atoi_printf(&fmt[*c_idx]);
|
||||||
if (atoi_res < 0)
|
if (atoi_res < 0)
|
||||||
{
|
{
|
||||||
*c_idx = *nxt;
|
*c_idx = *nxt;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue