Skip to content

Commit

Permalink
Add misc minor posix commands
Browse files Browse the repository at this point in the history
  • Loading branch information
davidar committed May 19, 2024
1 parent 15f3427 commit a6cfbe5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
4 changes: 1 addition & 3 deletions boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ EOF

[ ! -f /etc/resolv.conf ] && echo "nameserver 1.1.1.1" > /etc/resolv.conf

printf '#!/bin/sh\nexit 0' > /bin/true
printf '#!/bin/sh\nexit 1' > /bin/false
for cmd in `sh --list-builtins`; do
for cmd in $(sh --list-builtins); do
printf '#!/bin/sh\ncommand %s "$@"' "$cmd" > /bin/$cmd;
done
chmod +x /bin/*
Expand Down
26 changes: 13 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ CONFIG_CAT=y
CONFIG_CHGRP=y
CONFIG_CHOWN=y
CONFIG_CHMOD=y
# CONFIG_CKSUM is not set
# CONFIG_CRC32 is not set
CONFIG_CKSUM=y
CONFIG_CRC32=y
CONFIG_CMP=y
CONFIG_COMM=y
CONFIG_CP=y
Expand All @@ -81,7 +81,7 @@ CONFIG_DIRNAME=y
CONFIG_DU=y
# CONFIG_ECHO is not set
CONFIG_ENV=y
# CONFIG_EXPAND is not set
CONFIG_EXPAND=y
# CONFIG_FALSE is not set
CONFIG_FILE=y
CONFIG_FIND=y
Expand All @@ -94,9 +94,9 @@ CONFIG_HEAD=y
# CONFIG_ICONV is not set
CONFIG_ID=y
# CONFIG_ID_Z is not set
# CONFIG_GROUPS is not set
# CONFIG_LOGNAME is not set
# CONFIG_WHOAMI is not set
CONFIG_GROUPS=y
CONFIG_LOGNAME=y
CONFIG_WHOAMI=y
# CONFIG_KILL is not set
# CONFIG_KILLALL5 is not set
CONFIG_LINK=y
Expand All @@ -107,11 +107,11 @@ CONFIG_MKDIR=y
# CONFIG_MKDIR_Z is not set
CONFIG_MKFIFO=y
# CONFIG_MKFIFO_Z is not set
# CONFIG_NICE is not set
CONFIG_NICE=y
CONFIG_NL=y
# CONFIG_NOHUP is not set
CONFIG_NOHUP=y
CONFIG_OD=y
# CONFIG_PASTE is not set
CONFIG_PASTE=y
CONFIG_PATCH=y
# CONFIG_PRINTF is not set
# CONFIG_PS is not set
Expand All @@ -120,15 +120,15 @@ CONFIG_PATCH=y
# CONFIG_PGREP is not set
# CONFIG_PKILL is not set
# CONFIG_PWD is not set
# CONFIG_RENICE is not set
CONFIG_RENICE=y
CONFIG_RM=y
CONFIG_RMDIR=y
CONFIG_SED=y
CONFIG_SLEEP=y
CONFIG_SORT=y
CONFIG_SORT_FLOAT=y
# CONFIG_SPLIT is not set
# CONFIG_STRINGS is not set
CONFIG_STRINGS=y
CONFIG_TAIL=y
CONFIG_TAR=y
CONFIG_TEE=y
Expand All @@ -143,11 +143,11 @@ CONFIG_TTY=y
CONFIG_ARCH=y
CONFIG_UNAME=y
CONFIG_UNIQ=y
# CONFIG_UNLINK is not set
CONFIG_UNLINK=y
# CONFIG_UUDECODE is not set
# CONFIG_UUENCODE is not set
CONFIG_WC=y
# CONFIG_WHO is not set
CONFIG_WHO=y
CONFIG_XARGS=y
#
Expand Down
4 changes: 2 additions & 2 deletions src/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ shellexec(char **argv, const char *path, int idx)
toy_exec(argv);
}

if (!strcmp(argv[0], "cc")) {
if (!strcmp(argv[0], "cc") || !strcmp(argv[0], "c99")) {
exit(tcc_main(argc, argv));
}

Expand Down Expand Up @@ -510,7 +510,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
goto success;
}

if (toy_find(name) || !strcmp(name, "cc") || !strcmp(name, "ar")) {
if (toy_find(name) || !strcmp(name, "cc") || !strcmp(name, "c99") || !strcmp(name, "ar")) {
entry->u.index = -1;
entry->cmdtype = CMDNORMAL;
return;
Expand Down
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ main(int argc, char **argv)
if (argc > 1 && strcmp(argv[1], "--list-builtins") == 0) {
puts("ar");
puts("cc");
puts("c99");
for (int i = 0; i < NUMBUILTINS; i++) {
if (builtincmd[i].flags == 0 || builtincmd[i].flags == BUILTIN_REGULAR) {
puts(builtincmd[i].name);
Expand Down

0 comments on commit a6cfbe5

Please sign in to comment.