diff options
| author | Louis Burda <quent.burda@gmail.com> | 2024-10-29 14:23:35 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2024-10-29 14:23:35 +0100 |
| commit | dbde9185dce8df1501eb0f7f230669dddbc47d26 (patch) | |
| tree | 279841e981fe507d5dc52bd585975177d8f692cc | |
| download | exec0-master.tar.gz exec0-master.zip | |
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 18 | ||||
| -rw-r--r-- | exec0.c | 16 |
3 files changed, 35 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3236c6a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +exec0 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2cbc2ab --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ + +CFLAGS = -O3 -static + +all: exec0 + +exec0: exec0.c + +install: + install -m755 exec0 -t "$(DESTDIR)$(PREFIX)$(BINDIR)" + +uninstall: + rm -f "$(DESTDIR)$(PREFIX)$(BINDIR)/exec0" + +clean: + rm -f exec0 + +.PHONY: all clean install uninstall + @@ -0,0 +1,16 @@ +#include <stdio.h> +#include <unistd.h> + +int +main(int argc, char *const *argv) +{ + if (argc < 3) { + fprintf(stderr, "Usage: exec0 BIN ARGV0 [ARG..]\n"); + return 1; + } + if (execvp(argv[1], argv + 2)) { + perror("execvp"); + return 1; + } + return 0; +} |
