Resolve compiler warnings and udpate CFLAGS

This commit is contained in:
Night Kaly 2024-11-04 23:53:11 +00:00
parent 7fcaa3ba9b
commit 3e4a097e70
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM
7 changed files with 11 additions and 11 deletions

View file

@ -1,16 +1,16 @@
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
VERSION = 1.0 VERSION = "1.0"
TARGET = 90s TARGET = 90s
MANPAGE = $(TARGET).1 MANPAGE = $(TARGET).1
PREFIX ?= /usr/local PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1 MANDIR = $(PREFIX)/share/man/man1
CFLAGS = -O3 -march=native -mtune=native -pipe -s -flto -std=c99 -pedantic -Wall -DVERSION=$(VERSION) CFLAGS = -Os -march=native -mtune=native -pipe -s -flto -std=c99 -pedantic -Wall -DVERSION=$(VERSION) -D_DEFAULT_SOURCE
SRC = src/*.c SRC != find src -name *.c
INCLUDE = include INCLUDE = include
$(TARGET): $(SRC) $(TARGET): $(SRC)

View file

@ -2,7 +2,7 @@
#define COMMANDS_H_ #define COMMANDS_H_
char *replace_absolute_home(char *str); char *replace_absolute_home(char *str);
int num_builtins(); int num_builtins(void);
bool is_builtin(char *command); bool is_builtin(char *command);
int execute(char **args, int fd, int options); int execute(char **args, int fd, int options);
int execute_pipe(char ***args); int execute_pipe(char ***args);

View file

@ -4,7 +4,7 @@
extern int cmd_count; extern int cmd_count;
void save_command_history(char *args); void save_command_history(char *args);
void check_history_file(); void check_history_file(void);
char *read_command(int direction); char *read_command(int direction);
char **get_all_history(bool check); char **get_all_history(bool check);

View file

@ -35,7 +35,7 @@ void change_terminal_attribute(int option) {
} }
} }
char **setup_path_variable() { char **setup_path_variable(void) {
char *envpath = getenv("PATH"); char *envpath = getenv("PATH");
if (envpath == NULL) { if (envpath == NULL) {
fprintf(stderr, "90s: PATH environment variable is missing\n"); fprintf(stderr, "90s: PATH environment variable is missing\n");
@ -95,7 +95,7 @@ void shiftright(int chars) {
printf("\033[%dC", chars); printf("\033[%dC", chars);
} }
void clearline() { void clearline(void) {
printf("\033[K"); // clear line to the right of cursor printf("\033[K"); // clear line to the right of cursor
} }

View file

@ -58,7 +58,7 @@ char *shortcut_expand_dirs[] = {
"/usr/local/bin", "/usr/local/bin",
}; };
char *gethome() { char *gethome(void) {
char *home = getenv("HOME"); char *home = getenv("HOME");
if (home == NULL) { if (home == NULL) {
fprintf(stderr, "Error: HOME environment variable not set.\n"); fprintf(stderr, "Error: HOME environment variable not set.\n");
@ -118,7 +118,7 @@ char *replace_absolute_home(char *str) {
} }
// number of built in commands // number of built in commands
int num_builtins() { int num_builtins(void) {
return sizeof(builtin_cmds) / sizeof(char *); return sizeof(builtin_cmds) / sizeof(char *);
} }

View file

@ -21,7 +21,7 @@ FILE *open_history_file(char *mode) {
} }
return history_file; return history_file;
} }
void check_history_file() { void check_history_file(void) {
char *env_home; char *env_home;
env_home = getenv("XDG_CONFIG_HOME"); env_home = getenv("XDG_CONFIG_HOME");
if (env_home == NULL) { if (env_home == NULL) {

View file

@ -13,7 +13,7 @@ typedef struct job {
job *jobs = NULL; job *jobs = NULL;
int num_jobs() { int num_jobs(void) {
job *current = jobs; job *current = jobs;
int count = 0; int count = 0;
while (current != NULL) { while (current != NULL) {