summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile4
-rw-r--r--src/builtins.h62
-rw-r--r--src/mains.h62
-rw-r--r--src/sh.c3
4 files changed, 131 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index 56c54ca..7813a7f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,6 +2,8 @@
all: bosix
+CFLAGS=-Wall -Wextra -Wpedantic
+
OBJS= ar.o asa.o \
basename.o \
cal.o cat.o chgrp.o chmod.o chown.o cksum.o cmp.o cp.o crontab.o ctags.o \
@@ -25,5 +27,7 @@ OBJS= ar.o asa.o \
bosix: $(OBJS)
$(CC) -o $@ $(OBJS) -ll -ly
+sh.o: sh.c mains.h builtins.h
+
clean:
rm -f bosix *.o
diff --git a/src/builtins.h b/src/builtins.h
new file mode 100644
index 0000000..cd0c7ad
--- /dev/null
+++ b/src/builtins.h
@@ -0,0 +1,62 @@
+#define EXTRA_BUILTINS \
+ { "ar", ar_main }, \
+ { "asa", asa_main }, \
+ { "basename", basename_main }, \
+ { "cal", cal_main }, \
+ { "cat", cat_main }, \
+ { "chgrp", chgrp_main }, \
+ { "chmod", chmod_main }, \
+ { "chown", chown_main }, \
+ { "cksum", cksum_main }, \
+ { "cmp", cmp_main }, \
+ { "cp", cp_main }, \
+ { "crontab", crontab_main }, \
+ { "ctags", ctags_main }, \
+ { "date", date_main }, \
+ { "dd", dd_main }, \
+ { "dirname", dirname_main }, \
+ { "du", du_main }, \
+ { "ed", ed_main }, \
+ { "env", env_main }, \
+ { "ex", ex_main }, \
+ { "expand", expand_main }, \
+ { "file", file_main }, \
+ { "getconf", getconf_main }, \
+ { "grep", grep_main }, \
+ { "head", head_main }, \
+ { "iconv", iconv_main }, \
+ { "id", id_main }, \
+ { "link", link_main }, \
+ { "ln", ln_main }, \
+ { "locale", locale_main }, \
+ { "logger", logger_main }, \
+ { "logname", logname_main }, \
+ { "ls", ls_main }, \
+ { "mkdir", mkdir_main }, \
+ { "mkfifo", mkfifo_main }, \
+ { "more", more_main }, \
+ { "nice", nice_main }, \
+ { "nohup", nohup_main }, \
+ { "od", od_main }, \
+ { "paste", paste_main }, \
+ { "pathchk", pathchk_main }, \
+ { "printf", printf_main }, \
+ { "renice", renice_main }, \
+ { "rm", rm_main }, \
+ { "rmdir", rmdir_main }, \
+ { "sleep", sleep_main }, \
+ { "split", split_main }, \
+ { "strings", strings_main }, \
+ { "stty", stty_main }, \
+ { "sum", sum_main }, \
+ { "tail", tail_main }, \
+ { "tee", tee_main }, \
+ { "tput", tput_main }, \
+ { "tr", tr_main }, \
+ { "uname", uname_main }, \
+ { "unlink", unlink_main }, \
+ { "uudecode", uudecode_main }, \
+ { "uuencode", uuencode_main }, \
+ { "wc", wc_main }, \
+ { "who", who_main }, \
+ { "write", write_main },
diff --git a/src/mains.h b/src/mains.h
new file mode 100644
index 0000000..c40360b
--- /dev/null
+++ b/src/mains.h
@@ -0,0 +1,62 @@
+extern int ar_main(int argc, char *argv[]);
+extern int asa_main(int argc, char *argv[]);
+extern int basename_main(int argc, char *argv[]);
+extern int bc_main(int argc, char *argv[]);
+extern int cal_main(int argc, char *argv[]);
+extern int cat_main(int argc, char *argv[]);
+extern int chgrp_main(int argc, char *argv[]);
+extern int chmod_main(int argc, char *argv[]);
+extern int chown_main(int argc, char *argv[]);
+extern int cksum_main(int argc, char *argv[]);
+extern int cmp_main(int argc, char *argv[]);
+extern int cp_main(int argc, char *argv[]);
+extern int crontab_main(int argc, char *argv[]);
+extern int ctags_main(int argc, char *argv[]);
+extern int date_main(int argc, char *argv[]);
+extern int dd_main(int argc, char *argv[]);
+extern int dirname_main(int argc, char *argv[]);
+extern int du_main(int argc, char *argv[]);
+extern int ed_main(int argc, char *argv[]);
+extern int env_main(int argc, char *argv[]);
+extern int ex_main(int argc, char *argv[]);
+extern int expand_main(int argc, char *argv[]);
+extern int file_main(int argc, char *argv[]);
+extern int getconf_main(int argc, char *argv[]);
+extern int grep_main(int argc, char *argv[]);
+extern int head_main(int argc, char *argv[]);
+extern int iconv_main(int argc, char *argv[]);
+extern int id_main(int argc, char *argv[]);
+extern int link_main(int argc, char *argv[]);
+extern int ln_main(int argc, char *argv[]);
+extern int locale_main(int argc, char *argv[]);
+extern int logger_main(int argc, char *argv[]);
+extern int logname_main(int argc, char *argv[]);
+extern int ls_main(int argc, char *argv[]);
+extern int mkdir_main(int argc, char *argv[]);
+extern int mkfifo_main(int argc, char *argv[]);
+extern int more_main(int argc, char *argv[]);
+extern int nice_main(int argc, char *argv[]);
+extern int nohup_main(int argc, char *argv[]);
+extern int od_main(int argc, char *argv[]);
+extern int paste_main(int argc, char *argv[]);
+extern int pathchk_main(int argc, char *argv[]);
+extern int printf_main(int argc, char *argv[]);
+extern int renice_main(int argc, char *argv[]);
+extern int rm_main(int argc, char *argv[]);
+extern int rmdir_main(int argc, char *argv[]);
+extern int sleep_main(int argc, char *argv[]);
+extern int split_main(int argc, char *argv[]);
+extern int strings_main(int argc, char *argv[]);
+extern int stty_main(int argc, char *argv[]);
+extern int sum_main(int argc, char *argv[]);
+extern int tail_main(int argc, char *argv[]);
+extern int tee_main(int argc, char *argv[]);
+extern int tput_main(int argc, char *argv[]);
+extern int tr_main(int argc, char *argv[]);
+extern int uname_main(int argc, char *argv[]);
+extern int unlink_main(int argc, char *argv[]);
+extern int uudecode_main(int argc, char *argv[]);
+extern int uuencode_main(int argc, char *argv[]);
+extern int wc_main(int argc, char *argv[]);
+extern int who_main(int argc, char *argv[]);
+extern int write_main(int argc, char *argv[]);
diff --git a/src/sh.c b/src/sh.c
index 4c35370..058af28 100644
--- a/src/sh.c
+++ b/src/sh.c
@@ -1,3 +1,6 @@
+#include "mains.h"
+#include "builtins.h"
+
#include "../sh/alias.c"
#include "../sh/bg.c"
#include "../sh/builtins.c"