aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2022-12-17 17:38:03 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2022-12-17 17:38:03 +0100
commite0ec3f0a536fabe0c8c47dd64da77855c0824adc (patch)
treea009465731576dd8d0509f8c2f0c7023d1ddfbb7
parent0e0f22cde8fa9a8c9e0ff509a90727092e0af58b (diff)
resolve Warnings
-rw-r--r--lib/io/io.c2
-rw-r--r--lib/io/io.h4
-rw-r--r--lib/sys/execve.h2
-rw-r--r--smash/Makefile2
-rw-r--r--smash/exec.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/lib/io/io.c b/lib/io/io.c
index ed1ba14..160b4cb 100644
--- a/lib/io/io.c
+++ b/lib/io/io.c
@@ -19,7 +19,7 @@ void rstd(char *buf, unsigned long count)
read(STDIN_FD, buf, count);
}
-void wstdf__(const char *buf, void **args)
+void wstdf__(const char *buf, const void **args)
{
const char *start = buf;
for (; *buf; ++buf) {
diff --git a/lib/io/io.h b/lib/io/io.h
index b68a75d..06cc541 100644
--- a/lib/io/io.h
+++ b/lib/io/io.h
@@ -6,10 +6,10 @@
void wstd(const char *buf);
void rstd(char *buf, unsigned long count);
-void wstdf__(const char *buf, void **args);
+void wstdf__(const char *buf, const void **args);
#define wstdf(buf, ...) { \
- void *__wstdf__args__[] = { __VA_ARGS__ }; \
+ const void *__wstdf__args__[] = { __VA_ARGS__ }; \
wstdf__(buf, __wstdf__args__); \
}
diff --git a/lib/sys/execve.h b/lib/sys/execve.h
index 62ebefc..7939559 100644
--- a/lib/sys/execve.h
+++ b/lib/sys/execve.h
@@ -3,7 +3,7 @@
#include "syscalls.h"
-static int execve(const char *pathname, char *const argv[], char *const envp[])
+static int execve(const char *pathname, const char *argv[], const char *envp[])
{
return syscall(EXECVE, pathname, argv, envp);
}
diff --git a/smash/Makefile b/smash/Makefile
index 0f62c63..9612edf 100644
--- a/smash/Makefile
+++ b/smash/Makefile
@@ -17,4 +17,4 @@ unit_test_exec:
./test
all:
- gcc main.c exec.c parser.c builtin.c ../lib/env/env.c ../lib/io/io.c ../lib/avl_tree/avl_tree.c ../lib/cstr/cstr.c ../lib/malloc/malloc.c ../lib/sys/start.S -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -o smash -DVARIABLES_UNIT_TEST -g
+ gcc main.c exec.c parser.c builtin.c ../lib/env/env.c ../lib/io/io.c ../lib/avl_tree/avl_tree.c ../lib/cstr/cstr.c ../lib/malloc/malloc.c ../lib/sys/start.S -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -fno-builtin -o smash -DVARIABLES_UNIT_TEST -g
diff --git a/smash/exec.c b/smash/exec.c
index 11620a5..79c8414 100644
--- a/smash/exec.c
+++ b/smash/exec.c
@@ -91,7 +91,7 @@ void exec(char *line)
close(pipefd[1][PIPE_OUT]);
close(pipefd[1][PIPE_IN]);
- __execenv(argv);
+ __execenv((const char **)argv);
wstdf("command not found: %s\n", argv[0]);
exit(-1);
}