summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/posix_conformance.txt732
-rw-r--r--shell/msh_function.patch350
2 files changed, 366 insertions, 716 deletions
diff --git a/docs/posix_conformance.txt b/docs/posix_conformance.txt
index 5451a32..474465e 100644
--- a/docs/posix_conformance.txt
+++ b/docs/posix_conformance.txt
@@ -6,70 +6,70 @@ http://www.opengroup.org/onlinepubs/9699919799/
And the complete list of all utilities that POSIX covers:
http://www.opengroup.org/onlinepubs/9699919799/idx/utilities.html
-This listing is a work in progress, and currently only covers
+This listing is a work in progress, and currently only covers
tool options (not operands, enviroment variables, return codes, etc..).
For each option it is set if it (a) exists and (b) compliant to POSIX 2008.
Some options exist but there is no value in the 'compliant' column: that
-means no one has yet bothered to make sure that the option does what it is
+means no one has yet bothered to make sure that the option does what it is
required to do.
-----------------------------------------------
POSIX Tools supported only as shell built-ins (ash shell):
- alias, bg, cd, fg, getopts, hash, jobs, read, type, umask, ulimit,
+ alias, bg, cd, fg, getopts, hash, jobs, read, type, umask, ulimit,
unalias, wait, write
POSIX Tools not supported:
- asa, at, batch, bc, c99, command, compress, csplit, ex, fc, file,
- gencat, getconf, iconv, join, link, locale, localedef, lp, m4,
- mailx, newgrp, nl, paste, pathchk, pax, pr, qalter, qdel, qhold, qmove,
- qmsg, qrerun, qrls, qselect, qsig, qstat, qsub, tabs, talk, tput,
+ asa, at, batch, bc, c99, command, compress, csplit, ex, fc, file,
+ gencat, getconf, iconv, join, link, locale, localedef, lp, m4,
+ mailx, newgrp, nl, paste, pathchk, pax, pr, qalter, qdel, qhold, qmove,
+ qmsg, qrerun, qrls, qselect, qsig, qstat, qsub, tabs, talk, tput,
tsort, unlink, uucp, uustat, uux
POSIX Tools not supported (DEVELOPMENT):
- admin, cflow, ctags, cxref, delta, fort77, get, lex, make, nm, prs, rmdel,
+ admin, cflow, ctags, cxref, delta, fort77, get, lex, make, nm, prs, rmdel,
sact, sccs, strip, unget, val, what, yacc
POSIX Tools supported:
-Note: echo, printf, kill, pwd documented here as stand-alone applets,
+Note: echo, printf, kill, pwd documented here as stand-alone applets,
not as ash built-ins.
ar POSIX options ********************* Failed to recognize zip & tar (did not compare to regular ar)
option | exists | compliant | remarks
- -C | no | no |
- -T | no | no |
- -a | no | no |
- -b | no | no |
- -c | no | no |
- -d | no | no |
- -i | no | no |
- -m | no | no |
- -p | yes | |
- -q | no | no |
- -r | no | no |
- -s | no | no |
- -t | yes | |
- -u | no | no |
- -v | yes | |
- -x | yes | |
-ar Busybox specific options:
+ -C | no | no |
+ -T | no | no |
+ -a | no | no |
+ -b | no | no |
+ -c | no | no |
+ -d | no | no |
+ -i | no | no |
+ -m | no | no |
+ -p | yes | |
+ -q | no | no |
+ -r | no | no |
+ -s | no | no |
+ -t | yes | |
+ -u | no | no |
+ -v | yes | |
+ -x | yes | |
+ar Busybox specific options:
-o
awk POSIX options
option | exists | compliant | remarks
- -F ERE | yes | |
- -f progfile | yes | |
- -v assignment | yes | |
+ -F ERE | yes | |
+ -f progfile | yes | |
+ -v assignment | yes | |
awk Busybox specific options: None
basename POSIX options: None
basename Busybox specific options: None
cal POSIX options: None
-cal Busybox specific options:
+cal Busybox specific options:
-y, -j
cat POSIX options
@@ -79,28 +79,28 @@ cat Busybox specific options: None
chgrp POSIX options
option | exists | compliant | remarks
- -H | yes | |
- -L | yes | |
- -P | yes | |
- -R | yes | |
- -h | yes | |
-chgrp Busybox specific options:
+ -H | yes | |
+ -L | yes | |
+ -P | yes | |
+ -R | yes | |
+ -h | yes | |
+chgrp Busybox specific options:
-f, -c, -v
chmod POSIX options
option | exists | compliant | remarks
- -R | yes | yes |
-chmod Busybox specific options:
+ -R | yes | yes |
+chmod Busybox specific options:
-f, -v, -c
chown POSIX options *********************************************
option | exists | compliant | remarks
-H | yes | | It seems like all flags are supported (according to printout), but
-L | yes | | it fails to work on my machine
- -P | yes | |
- -R | yes | |
- -h | yes | |
-chown Busybox specific options:
+ -P | yes | |
+ -R | yes | |
+ -h | yes | |
+chown Busybox specific options:
-f, -c, -v
cksum POSIX options: None
@@ -108,52 +108,52 @@ cksum Busybox specific options: None
cmp POSIX options
option | exists | compliant | remarks
- -l | yes | yes |
- -s | yes | yes |
-cmp Busybox specific options:
-
+ -l | yes | yes |
+ -s | yes | yes |
+cmp Busybox specific options:
+
comm POSIX options
option | exists | compliant | remarks
- -1 | yes | yes |
- -2 | yes | yes |
- -3 | yes | yes |
+ -1 | yes | yes |
+ -2 | yes | yes |
+ -3 | yes | yes |
comm Busybox specific options: None
cp POSIX options
option | exists | compliant | remarks
- -H | yes | yes |
- -L | yes | yes |
- -P | yes | yes |
- -R | yes | yes |
- -f | yes | yes |
- -i | yes | yes |
- -p | yes | yes |
-cp Busybox specific options:
+ -H | yes | yes |
+ -L | yes | yes |
+ -P | yes | yes |
+ -R | yes | yes |
+ -f | yes | yes |
+ -i | yes | yes |
+ -p | yes | yes |
+cp Busybox specific options:
-d, -a, -s, -c, -r, -l
crontab POSIX options
option | exists | compliant | remarks
- -e | yes | |
- -l | yes | |
- -r | yes | |
-crontab Busybox specific options:
+ -e | yes | |
+ -l | yes | |
+ -r | yes | |
+crontab Busybox specific options:
-u, -c
cut POSIX options
option | exists | compliant | remarks
- -b list | yes | yes |
- -c list | yes | yes |
- -d delim | yes | yes |
- -f list | yes | yes |
- -n | yes | yes |
- -s | yes | yes |
+ -b list | yes | yes |
+ -c list | yes | yes |
+ -d delim | yes | yes |
+ -f list | yes | yes |
+ -n | yes | yes |
+ -s | yes | yes |
cut Busybox specific options: None
date POSIX options
option | exists | compliant | remarks
- -u | yes | yes |
-date Busybox specific options:
+ -u | yes | yes |
+date Busybox specific options:
-I[SPEC], -d TIME, -r FILE, -R, -D FMT
dd POSIX options:
@@ -167,7 +167,7 @@ dd POSIX options:
skip | yes | |
seek | yes | |
count | yes | |
- conv=ascii | no | no |
+ conv=ascii | no | no |
conv=ebcdic | no | no |
conv=ibm | no | no |
conv=block | no | no |
@@ -178,30 +178,30 @@ dd POSIX options:
conv=noerror | yes | |
conv=notrunc | yes | |
conv=sync | yes | |
-dd Busybox specific options:
+dd Busybox specific options:
conv=fsync
df POSIX options
option | exists | compliant | remarks
- -P | yes | yes |
- -k | yes | yes |
- -t | no | no |
-df Busybox specific options:
+ -P | yes | yes |
+ -k | yes | yes |
+ -t | no | no |
+df Busybox specific options:
-a, -m, -B SIZE, -i, -h
Remark:
- It seems that GNU df does not round percents up in its output (thus its results are a bit different)
diff POSIX options
option | exists | compliant | remarks
- -C n | no | no |
- -U n | yes | |
- -b | yes | |
- -c | no | no |
- -e | no | no |
- -f | no | no |
- -r | yes | |
- -u | no | no |
-diff Busybox specific options:
+ -C n | no | no |
+ -U n | yes | |
+ -b | yes | |
+ -c | no | no |
+ -e | no | no |
+ -f | no | no |
+ -r | yes | |
+ -u | no | no |
+diff Busybox specific options:
-d, -a, -s, -t, -L, -N, -i, -T, -w, -q, -S
dirname POSIX options: None
@@ -209,60 +209,60 @@ dirname Busybox specific options: None
du POSIX options
option | exists | compliant | remarks
- -H | yes | |
- -L | yes | |
- -a | yes | |
- -k | yes | |
- -s | yes | |
- -x | yes | |
-du Busybox specific options:
+ -H | yes | |
+ -L | yes | |
+ -a | yes | |
+ -k | yes | |
+ -s | yes | |
+ -x | yes | |
+du Busybox specific options:
-c, -m, -h, -d N, -l
echo POSIX options: None
option | exists | compliant | remarks
-n | yes | yes | The result of -n is "implementation-defined"
-echo Busybox specific options:
+echo Busybox specific options:
-e, -E
ed POSIX options
option | exists | compliant | remarks
- -p string | no | no |
- -s | no | no |
+ -p string | no | no |
+ -s | no | no |
ed Busybox specific options: None
env POSIX options
option | exists | compliant | remarks
- -i | no | no |
-env Busybox specific options:
+ -i | no | no |
+env Busybox specific options:
-u, -, -i
expand POSIX options
option | exists | compliant | remarks
- -t tablist | yes | yes |
-expand Busybox specific options:
+ -t tablist | yes | yes |
+expand Busybox specific options:
--tabs=N, -i, --initial
expr POSIX operations:
option | exists | compliant | remarks
- | | yes | yes |
- & | yes | yes |
- = | yes | yes |
- > | yes | yes |
- >= | yes | yes |
- <= | yes | yes |
- < | yes | yes |
- != | yes | yes |
- + | yes | yes |
- - | yes | yes |
- * | yes | yes |
- / | yes | yes |
- % | yes | yes |
- : | yes | yes |
- (expr) | yes | yes |
- integer | yes | yes |
- string | yes | yes |
-expr Busybox specific operations:
+ | | yes | yes |
+ & | yes | yes |
+ = | yes | yes |
+ > | yes | yes |
+ >= | yes | yes |
+ <= | yes | yes |
+ < | yes | yes |
+ != | yes | yes |
+ + | yes | yes |
+ - | yes | yes |
+ * | yes | yes |
+ / | yes | yes |
+ % | yes | yes |
+ : | yes | yes |
+ (expr) | yes | yes |
+ integer | yes | yes |
+ string | yes | yes |
+expr Busybox specific operations:
match, substr, index, length, quote
false POSIX options: None
@@ -270,104 +270,104 @@ false Busybox specific options: None
find POSIX options
option | exists | compliant | remarks
- -H | no | no |
- -L | no | no |
-find Busybox specific options:
+ -H | no | no |
+ -L | no | no |
+find Busybox specific options:
-group NAME, -mtime DAYS, -print, -maxdepth N, -exec CMD ARG ;, -newer FILE, -context, -iname PATTERN, -follow, -depth, -xdev, -inum N, -type X, -print0, -mindepth N, -mmin MINS, -regex PATTERN, -prune, -path PATTERN, -user NAME, -delete, -perm NNN, -name PATTERN, -size N[bck]
fold POSIX options
option | exists | compliant | remarks
- -b | yes | yes |
- -s | yes | yes |
- -w width | yes | yes |
+ -b | yes | yes |
+ -s | yes | yes |
+ -w width | yes | yes |
fold Busybox specific options: None
fuser POSIX options
option | exists | compliant | remarks
- -c | no | no |
- -f | no | no |
- -u | no | no |
-fuser Busybox specific options:
+ -c | no | no |
+ -f | no | no |
+ -u | no | no |
+fuser Busybox specific options:
-m, -k, -4, -SIGNAL, -6, -s
grep POSIX options
option | exists | compliant | remarks
- -E | yes | |
- -F | yes | |
- -c | yes | |
- -e pattern_list | yes | |
- -f pattern_file | yes | |
- -i | yes | |
- -l | yes | |
- -n | yes | |
- -q | yes | |
- -s | yes | |
- -v | yes | |
- -x | no | no |
-grep Busybox specific options:
+ -E | yes | |
+ -F | yes | |
+ -c | yes | |
+ -e pattern_list | yes | |
+ -f pattern_file | yes | |
+ -i | yes | |
+ -l | yes | |
+ -n | yes | |
+ -q | yes | |
+ -s | yes | |
+ -v | yes | |
+ -x | no | no |
+grep Busybox specific options:
-A, -C, -B, -L, -H, -o, -h, -w, -r, -z, -m MAX
head POSIX options
option | exists | compliant | remarks
- -n number | yes | yes |
-head Busybox specific options:
+ -n number | yes | yes |
+head Busybox specific options:
-v, -c NUM, -q
id POSIX options
option | exists | compliant | remarks
- -G | yes | yes |
- -g | yes | yes |
- -n | yes | yes |
- -r | yes | yes |
- -u | yes | yes |
-id Busybox specific options:
+ -G | yes | yes |
+ -g | yes | yes |
+ -n | yes | yes |
+ -r | yes | yes |
+ -u | yes | yes |
+id Busybox specific options:
-Z
ipcrm POSIX options
option | exists | compliant | remarks
- -M shmkey | no | no |
- -Q msgkey | no | no |
- -S semkey | no | no |
- -m shmid | no | no |
- -q msgid | no | no |
- -s semid | no | no |
-ipcrm Busybox specific options:
+ -M shmkey | no | no |
+ -Q msgkey | no | no |
+ -S semkey | no | no |
+ -m shmid | no | no |
+ -q msgid | no | no |
+ -s semid | no | no |
+ipcrm Busybox specific options:
-mM, -qQ, -sS
ipcs POSIX options
option | exists | compliant | remarks
- -a | yes | |
- -b | no | no |
- -c | yes | |
- -m | yes | |
- -o | no | no |
- -p | yes | |
- -q | yes | |
- -s | yes | |
- -t | yes | |
-ipcs Busybox specific options:
+ -a | yes | |
+ -b | no | no |
+ -c | yes | |
+ -m | yes | |
+ -o | no | no |
+ -p | yes | |
+ -q | yes | |
+ -s | yes | |
+ -t | yes | |
+ipcs Busybox specific options:
-l, -i, -u
kill POSIX options
option | exists | compliant | remarks
- -l | yes | yes |
- -s signal_name | yes | yes |
- -signal_name | yes | yes |
- -signal_number | yes | yes |
-kill Busybox specific options:
+ -l | yes | yes |
+ -s signal_name | yes | yes |
+ -signal_name | yes | yes |
+ -signal_number | yes | yes |
+kill Busybox specific options:
-q, -o
ln POSIX options
option | exists | compliant | remarks
- -L | no | no |
- -P | no | no |
- -f | yes | yes |
- -s | yes | yes |
-ln Busybox specific options:
+ -L | no | no |
+ -P | no | no |
+ -f | yes | yes |
+ -s | yes | yes |
+ln Busybox specific options:
-S suf, -n, -b
logger POSIX options: None
-logger Busybox specific options:
+logger Busybox specific options:
-p PRIO, -t TAG, -s
logname POSIX options: None
@@ -375,39 +375,39 @@ logname Busybox specific options: None
ls POSIX options
option | exists | compliant | remarks
- -1 | yes | yes |
- -A | yes | yes |
- -C | yes | yes |
+ -1 | yes | yes |
+ -A | yes | yes |
+ -C | yes | yes |
-F | yes | yes | And more: '=' for sockets (not defined by POSIX)
- -H | no | no |
+ -H | no | no |
-L | yes | yes | But coloring may be wrong (at least POSIX does not require correct colors :) )
- -R | yes | yes |
- -S | yes | yes |
- -a | yes | yes |
+ -R | yes | yes |
+ -S | yes | yes |
+ -a | yes | yes |
-c | yes | no | Sorts output with '-l' (should only show ctime with '-l', and sort only with '-t')
-d | yes | no | When invoked together with '-L' should read symbolic links, and doesn't
- -f | no | no |
- -g | no | no |
- -i | yes | yes |
+ -f | no | no |
+ -g | no | no |
+ -i | yes | yes |
-k | yes | no | Does something completely unrelated! (Lists security context instead of specifying block size)
- -l | yes | yes |
- -m | no | no |
+ -l | yes | yes |
+ -m | no | no |
-n | yes | no | Works correctly only together with '-l' (but POSIX requires '-l' to be implicitly assumed)
- -o | no | no |
- -p | yes | yes |
- -q | no | no |
- -r | yes | yes |
- -s | yes | yes |
- -t | yes | yes |
- -u | yes | yes |
- -x | yes | yes |
-ls Busybox specific options:
+ -o | no | no |
+ -p | yes | yes |
+ -q | no | no |
+ -r | yes | yes |
+ -s | yes | yes |
+ -t | yes | yes |
+ -u | yes | yes |
+ -x | yes | yes |
+ls Busybox specific options:
--color, -T NUM, -K, -X, -Z, -e, -h, -v, -w NUM
man POSIX options
option | exists | compliant | remarks
- -k | no | no |
-man Busybox specific options:
+ -k | no | no |
+man Busybox specific options:
-a Display all pages
@@ -416,38 +416,38 @@ mesg Busybox specific options: None
mkdir POSIX options
option | exists | compliant | remarks
- -m mode | yes | yes |
- -p | yes | yes |
-mkdir Busybox specific options:
+ -m mode | yes | yes |
+ -p | yes | yes |
+mkdir Busybox specific options:
-Z
mkfifo POSIX options
option | exists | compliant | remarks
- -m mode | yes | yes |
-mkfifo Busybox specific options:
+ -m mode | yes | yes |
+mkfifo Busybox specific options:
-Z
more POSIX options
option | exists | compliant | remarks
- -c | no | no |
- -e | no | no |
- -i | no | no |
- -n number | no | no |
- -p command | no | no |
- -s | no | no |
- -t tagstring | no | no |
- -u | no | no |
+ -c | no | no |
+ -e | no | no |
+ -i | no | no |
+ -n number | no | no |
+ -p command | no | no |
+ -s | no | no |
+ -t tagstring | no | no |
+ -u | no | no |
more Busybox specific options: None
mv POSIX options
option | exists | compliant | remarks
- -f | yes | yes |
- -i | yes | yes |
+ -f | yes | yes |
+ -i | yes | yes |
mv Busybox specific options: None
nice POSIX options
option | exists | compliant | remarks
- -n increment | yes | yes |
+ -n increment | yes | yes |
nice Busybox specific options: None
nohup POSIX options: None
@@ -455,35 +455,35 @@ nohup Busybox specific options: None
od POSIX options
option | exists | compliant | remarks
- -A address_base | no | no |
- -N count | no | no |
- -b | no | no |
- -c | no | no |
- -d | no | no |
- -j skip | no | no |
- -o | no | no |
- -s | no | no |
- -t type_string | no | no |
- -v | no | no |
- -x | no | no |
+ -A address_base | no | no |
+ -N count | no | no |
+ -b | no | no |
+ -c | no | no |
+ -d | no | no |
+ -j skip | no | no |
+ -o | no | no |
+ -s | no | no |
+ -t type_string | no | no |
+ -v | no | no |
+ -x | no | no |
od Busybox specific options: None
patch POSIX options
option | exists | compliant | remarks
- -D define | no | no |
- -N | no | no |
- -R | yes | yes |
- -b | no | no |
- -c | no | no |
- -d dir | no | no |
- -e | no | no |
- -i patchfile | yes | yes |
- -l | no | no |
- -n | no | no |
- -o outfile | no | no |
- -p num | yes | yes |
- -r rejectfile | no | no |
- -u | no | no |
+ -D define | no | no |
+ -N | no | no |
+ -R | yes | yes |
+ -b | no | no |
+ -c | no | no |
+ -d dir | no | no |
+ -e | no | no |
+ -i patchfile | yes | yes |
+ -l | no | no |
+ -n | no | no |
+ -o outfile | no | no |
+ -p num | yes | yes |
+ -r rejectfile | no | no |
+ -u | no | no |
patch Busybox specific options: None
printf POSIX options: None
@@ -491,63 +491,63 @@ printf Busybox specific options: None
ps POSIX options
option | exists | compliant | remarks
- -A | no | no |
- -G grouplist | no | no |
- -U userlist | no | no |
- -a | no | no |
- -d | no | no |
- -e | no | no |
- -f | no | no |
- -g grouplist | no | no |
- -l | no | no |
- -n namelist | no | no |
+ -A | no | no |
+ -G grouplist | no | no |
+ -U userlist | no | no |
+ -a | no | no |
+ -d | no | no |
+ -e | no | no |
+ -f | no | no |
+ -g grouplist | no | no |
+ -l | no | no |
+ -n namelist | no | no |
-o format | yes | no | not supported: ruser, group, rgroup, pcpu
- -p proclist | no | no |
- -t termlist | no | no |
- -u userlist | no | no |
+ -p proclist | no | no |
+ -t termlist | no | no |
+ -u userlist | no | no |
ps Busybox specific options: None
pwd POSIX options
option | exists | compliant | remarks
- -L | no | no |
- -P | no | no |
+ -L | no | no |
+ -P | no | no |
pwd Busybox specific options: None
renice POSIX options
option | exists | compliant | remarks
- -g | yes | yes |
+ -g | yes | yes |
-n increment | yes | yes | Note POSIX allows only to run with this option (busybox also allows to run without '-n' and set niceness directly)
- -p | yes | yes |
- -u | yes | yes |
+ -p | yes | yes |
+ -u | yes | yes |
renice Busybox specific options: None
rm POSIX options
option | exists | compliant | remarks
- -R | yes | yes |
- -f | yes | yes |
- -i | yes | yes |
- -r | yes | yes |
+ -R | yes | yes |
+ -f | yes | yes |
+ -i | yes | yes |
+ -r | yes | yes |
rm Busybox specific options: None
rmdir POSIX options
option | exists | compliant | remarks
- -p | yes | yes |
-rmdir Busybox specific options:
+ -p | yes | yes |
+rmdir Busybox specific options:
--parents
sed POSIX options
option | exists | compliant | remarks
- -e script | yes | |
- -f script_file | yes | |
- -n | yes | |
-sed Busybox specific options:
+ -e script | yes | |
+ -f script_file | yes | |
+ -n | yes | |
+sed Busybox specific options:
-i, -r
sh POSIX options
option | exists | compliant | remarks
- -c | no | no |
- -i | no | no |
- -s | no | no |
+ -c | no | no |
+ -i | no | no |
+ -s | no | no |
sh Busybox specific options: None
sleep POSIX options: None
@@ -555,58 +555,58 @@ sleep Busybox specific options: None
sort POSIX options
option | exists | compliant | remarks
- -C | no | no |
- -b | yes | yes |
- -c | yes | yes |
- -d | yes | yes |
- -f | yes | yes |
+ -C | no | no |
+ -b | yes | yes |
+ -c | yes | yes |
+ -d | yes | yes |
+ -f | yes | yes |
-i | yes | yes | But is not like GNU sort, which isn't! (try to sort 'a\nA\nB\nb' with and without -f)
- -k keydef | yes | |
- -m | no | no |
- -n | yes | yes |
- -o output | yes | yes |
- -r | yes | yes |
- -t char | yes | |
- -u | yes | yes |
-sort Busybox specific options:
+ -k keydef | yes | |
+ -m | no | no |
+ -n | yes | yes |
+ -o output | yes | yes |
+ -r | yes | yes |
+ -t char | yes | |
+ -u | yes | yes |
+sort Busybox specific options:
-mST, -g, -M, -s, -z
split POSIX options
option | exists | compliant | remarks
- -a suffix_length | yes | yes |
- -b n | yes | yes |
- -b nk | yes | yes |
- -b nm | yes | yes |
- -l line_count | yes | yes |
+ -a suffix_length | yes | yes |
+ -b n | yes | yes |
+ -b nk | yes | yes |
+ -b nm | yes | yes |
+ -l line_count | yes | yes |
split Busybox specific options: None
strings POSIX options
option | exists | compliant | remarks
- -a | yes | yes |
- -n number | yes | yes |
- -t format | no | no |
-strings Busybox specific options:
+ -a | yes | yes |
+ -n number | yes | yes |
+ -t format | no | no |
+strings Busybox specific options:
-o, -f
stty POSIX options
option | exists | compliant | remarks
- -a | yes | yes |
- -g | yes | yes |
-stty Busybox specific options:
+ -a | yes | yes |
+ -g | yes | yes |
+stty Busybox specific options:
-F DEVICE
tail POSIX options
option | exists | compliant | remarks
- -c number | yes | yes |
- -f | yes | yes |
- -n number | yes | yes |
-tail Busybox specific options:
+ -c number | yes | yes |
+ -f | yes | yes |
+ -n number | yes | yes |
+tail Busybox specific options:
-v, -q, -s SEC
tee POSIX options
option | exists | compliant | remarks
- -a | yes | yes |
- -i | yes | yes |
+ -a | yes | yes |
+ -i | yes | yes |
tee Busybox specific options: None
test POSIX options: None
@@ -614,127 +614,127 @@ test Busybox specific options: None
time POSIX options
option | exists | compliant | remarks
- -p | no | no |
-time Busybox specific options:
+ -p | no | no |
+time Busybox specific options:
-v
touch POSIX options
option | exists | compliant | remarks
- -a | no | no |
- -c | yes | yes |
- -d date_time | no | no |
- -m | no | no |
- -r ref_file | no | no |
- -t time | no | no |
+ -a | no | no |
+ -c | yes | yes |
+ -d date_time | no | no |
+ -m | no | no |
+ -r ref_file | no | no |
+ -t time | no | no |
touch Busybox specific options: None
tr POSIX options
option | exists | compliant | remarks
- -C | no | no |
- -c | yes | yes |
- -d | yes | yes |
- -s | yes | yes |
+ -C | no | no |
+ -c | yes | yes |
+ -d | yes | yes |
+ -s | yes | yes |
tr Busybox specific options: None
true POSIX options: None
true Busybox specific options: None
tty POSIX options: None
-tty Busybox specific options:
+tty Busybox specific options:
-s
uname POSIX options
option | exists | compliant | remarks
- -a | yes | yes |
- -m | yes | yes |
- -n | yes | yes |
- -r | yes | yes |
- -s | yes | yes |
- -v | yes | yes |
-uname Busybox specific options:
+ -a | yes | yes |
+ -m | yes | yes |
+ -n | yes | yes |
+ -r | yes | yes |
+ -s | yes | yes |
+ -v | yes | yes |
+uname Busybox specific options:
-p
uncompress POSIX options
option | exists | compliant | remarks
- -c | yes | yes |
- -f | yes | yes |
- -v | no | no |
+ -c | yes | yes |
+ -f | yes | yes |
+ -v | no | no |
uncompress Busybox specific options: None
unexpand POSIX options
option | exists | compliant | remarks
-a | yes | no | POSIX requires converting two or more spaces to tabs, busybox converts one or more spaces
- -t tablist | yes | yes |
-unexpand Busybox specific options:
+ -t tablist | yes | yes |
+unexpand Busybox specific options:
--tabs=N, -f, --first-only, --all
uniq POSIX options
option | exists | compliant | remarks
- -c | yes | yes |
- -d | yes | yes |
- -f fields | yes | yes |
- -s chars | yes | yes |
- -u | yes | yes |
-uniq Busybox specific options:
+ -c | yes | yes |
+ -d | yes | yes |
+ -f fields | yes | yes |
+ -s chars | yes | yes |
+ -u | yes | yes |
+uniq Busybox specific options:
-w N
uudecode POSIX options
option | exists | compliant | remarks
- -o outfile | no | no |
+ -o outfile | no | no |
uudecode Busybox specific options: None
uuencode POSIX options
option | exists | compliant | remarks
- -m | yes | yes |
+ -m | yes | yes |
uuencode Busybox specific options: None
vi POSIX options
option | exists | compliant | remarks
- -R | yes | |
- -c command | yes | |
- -r | no | no |
- -t tagstring | no | no |
- -w size | no | no |
-vi Busybox specific options:
+ -R | yes | |
+ -c command | yes | |
+ -r | no | no |
+ -t tagstring | no | no |
+ -w size | no | no |
+vi Busybox specific options:
-H
wc POSIX options
option | exists | compliant | remarks
- -c | yes | yes |
- -l | yes | yes |
- -m | no | no |
- -w | yes | yes |
-wc Busybox specific options:
+ -c | yes | yes |
+ -l | yes | yes |
+ -m | no | no |
+ -w | yes | yes |
+wc Busybox specific options:
-L
who POSIX options
option | exists | compliant | remarks
- -H | no | no |
- -T | no | no |
+ -H | no | no |
+ -T | no | no |
-a | yes | no | just shows all
- -b | no | no |
- -d | no | no |
- -l | no | no |
- -m | no | no |
- -p | no | no |
- -q | no | no |
- -r | no | no |
- -s | no | no |
- -t | no | no |
- -u | no | no |
+ -b | no | no |
+ -d | no | no |
+ -l | no | no |
+ -m | no | no |
+ -p | no | no |
+ -q | no | no |
+ -r | no | no |
+ -s | no | no |
+ -t | no | no |
+ -u | no | no |
who Busybox specific options: None
xargs POSIX options
option | exists | compliant | remarks
- -E eofstr | no | no |
- -I replstr | no | no |
- -L number | no | no |
- -n number | yes | yes |
- -p | yes | yes |
- -s size | yes | yes |
- -t | yes | yes |
- -x | yes | yes |
-xargs Busybox specific options:
+ -E eofstr | no | no |
+ -I replstr | no | no |
+ -L number | no | no |
+ -n number | yes | yes |
+ -p | yes | yes |
+ -s size | yes | yes |
+ -t | yes | yes |
+ -x | yes | yes |
+xargs Busybox specific options:
-e[STR], -0, -r
zcat POSIX options: None
diff --git a/shell/msh_function.patch b/shell/msh_function.patch
deleted file mode 100644
index 270b9ee..0000000
--- a/shell/msh_function.patch
+++ /dev/null
@@ -1,350 +0,0 @@
-This is a "function" patch for msh which is in use by some busybox
-users. Unfortunately it is far too buggy to be applied, but maybe
-it's a useful starting point for future work.
-
-Function-related code is delimited by comments of the form
- //funccode:start
- ...
- //funccode:end
-for ease of grepping
-
-An example of buggy behavior:
-
-#f() {
-# echo foo
-# echo test`echo bar >&2`
-# echo END f
-#}
-
-function g {
-# echo 2 foo
-# echo 2 test`echo 2 bar >&2`
-# f
- echo END g
-# echo "1:'$1' 2:'$2'"
-}
-
-# Even this first block fails - it does not even call functions!
-# (replacing "echo END g" above with "echo END" makes it run ok)
-echo DRY RUN
- echo 2 foo
- echo 2 test`echo 2 bar >&2`
- echo END g
- echo "1:'$1' 2:'$2'"
- echo foo
- echo test`echo bar >&2`
- echo END f
-echo END DRY RUN
-
-exit
-
-# This would fail too
-g "$1-one" "two$2"
-echo DONE
-
-
-
-diff -d -urpN busybox.7/shell/msh.c busybox.8/shell/msh.c
---- busybox.7/shell/msh.c 2008-06-09 09:34:45.000000000 +0200
-+++ busybox.8/shell/msh.c 2008-06-09 09:38:17.000000000 +0200
-@@ -89,6 +89,14 @@ static char *itoa(int n)
-
- //#define MSHDEBUG 4
-
-+/* Used only in "function" support code */
-+#ifdef KSDBG //funccode:start
-+ #define KSDBG_PRINT_FUNCNAME fprintf(stderr, "in %s\n", __FUNCTION__)
-+#else
-+ #define KSDBG_PRINT_FUNCNAME ((void)0)
-+#endif
-+//funccode:end
-+
- #ifdef MSHDEBUG
- static int mshdbg = MSHDEBUG;
-
-@@ -220,6 +228,9 @@ struct op {
- #define TASYNC 16 /* c & */
- /* Added to support "." file expansion */
- #define TDOT 17
-+#define TFUNC 18 //funccode:start
-+#define TRETURN 19
-+ //funccode:end
-
- /* Strings for names to make debug easier */
- #ifdef MSHDEBUG
-@@ -319,6 +330,27 @@ struct region {
- int area;
- };
-
-+static int func_finished; //funccode:start
-+struct func {
-+ char* name;
-+ int begin_addr; /* pos in buffer of function */
-+ int end_addr;
-+};
-+#define MAX_FUNCS 100
-+
-+static struct func funcs[MAX_FUNCS];
-+
-+/* the max DEPTH of function call */
-+#define MAX_DEPTH 100
-+static struct _frame_s {
-+ int argc;
-+ char **argv;
-+ int saved_return_addr;
-+} frame[MAX_DEPTH];
-+
-+static void register_func(int begin, int end);
-+static struct func* find_func(char* name);
-+static void exec_func(struct func* f); //funccode:end
-
- /* -------- grammar stuff -------- */
- typedef union {
-@@ -347,6 +379,8 @@ typedef union {
- #define IN 272
- /* Added for "." file expansion */
- #define DOT 273
-+#define FUNC 274 //funccode:start
-+#define RETURN 275 //funccode:end
-
- #define YYERRCODE 300
-
-@@ -1722,6 +1756,40 @@ static struct op *simple(void)
- (void) synio(0);
- break;
-
-+ case FUNC: { //funccode:start
-+ int stop_flag;
-+ int number_brace;
-+ int func_begin;
-+ int func_end;
-+ int c;
-+ while ((c = my_getc(0)) == ' ' || c == '\t'|| c == '\n') /* skip whitespace */
-+ continue;
-+ stop_flag = 1;
-+ number_brace = 0;
-+ func_begin = global_env.iobase->argp->afpos;
-+ while (stop_flag) {
-+ if (c == '{')
-+ number_brace++;
-+ if (c == '}')
-+ number_brace--;
-+ if (!number_brace) /* if we reach the brace of most outsite */
-+ stop_flag = 0;
-+ c = my_getc(0);
-+ }
-+ unget(c);
-+ unget(c);
-+ func_end = global_env.iobase->argp->afpos;
-+ register_func(func_begin, func_end);
-+ peeksym = 0;
-+ t = NULL;
-+ return t;
-+ }
-+ case RETURN:
-+ func_finished = 1;
-+ peeksym = 0;
-+ t = NULL;
-+ return t; //funccode:end
-+
- case WORD:
- if (t == NULL) {
- t = newtp();
-@@ -2265,6 +2333,13 @@ static int yylex(int cf)
- case ')':
- startl = 1;
- return c;
-+ case '{': //funccode:start
-+ c = collect(c, '}');
-+ if (c != '\0')
-+ return c;
-+ break;
-+ case '}':
-+ return RETURN; //funccode:end
- }
-
- unget(c);
-@@ -2293,9 +2368,172 @@ static int yylex(int cf)
- }
-
- yylval.cp = strsave(line, areanum);
-+ /* To identify a subroutine */ //funccode:start
-+ c = my_getc(0);
-+ if (c && any(c, "(")) {
-+ c = my_getc(0);
-+ if (c && any(c, ")"))
-+ return FUNC;
-+ zzerr();
-+ } else
-+ unget(c);
-+ /* read the first char */
-+ /* To identify a function */
-+ if (strcmp(yylval.cp, "function") == 0) {
-+ int ret = yylex(0);
-+ /* read the function name after "function" */
-+ if (ret == WORD)
-+ return (FUNC);
-+ zzerr();
-+ }
-+ {
-+ struct func* f = find_func(yylval.cp);
-+ if (f != NULL) {
-+ exec_func(f);
-+ return RETURN;
-+ }
-+ }
-+ if (yylval.cp != NULL && strcmp(yylval.cp, "return") == 0) {
-+ return RETURN;
-+ } //funccode:end
- return WORD;
- }
-
-+static void register_func(int begin, int end) //funccode:start
-+{
-+ struct func *p;
-+ int i;
-+ for (i = 0; i < MAX_FUNCS; i++) {
-+ if (funcs[i].name == NULL) {
-+ p = &funcs[i];
-+ break;
-+ }
-+ }
-+ if (i == MAX_FUNCS) {
-+ fprintf(stderr, "Too much functions beyond limit\n");
-+ leave();
-+ }
-+ p->name = xstrdup(yylval.cp);
-+ //fprintf(stderr, "register function,%d,%d,%s\n", begin, end, p->name);
-+ KSDBG_PRINT_FUNCNAME;
-+ /* io stream */
-+ p->begin_addr = begin;
-+ p->end_addr = end;
-+}
-+
-+static struct func* find_func(char* name)
-+{
-+ int i;
-+ for (i = 0; i < MAX_FUNCS; i++) {
-+ if (funcs[i].name == NULL)
-+ continue;
-+ if (!strcmp(funcs[i].name, name))
-+ return &funcs[i];
-+ }
-+ KSDBG_PRINT_FUNCNAME;
-+ //fprintf(stderr, "not found the function %s\n", name);
-+ return NULL;
-+ //zzerr();
-+}
-+
-+/* Begin to execute the function */
-+static int cur_frame = 0;
-+
-+static void exec_func(struct func* f)
-+{
-+ int c;
-+ int temp_argc;
-+ char** temp_argv;
-+ struct iobuf *bp;
-+
-+ /* create a new frame, save the argument and return address to this frame */
-+ frame[cur_frame].argc = dolc;
-+ frame[cur_frame].argv = dolv;
-+
-+ cur_frame++;
-+ /* do some argument parse and set arguments */
-+ temp_argv = xmalloc(sizeof(char *));
-+ temp_argv[0] = xstrdup(f->name);
-+ temp_argc = 0;
-+ global_env.iop->argp->afpos--;
-+ global_env.iop->argp->afbuf->bufp--;
-+// unget(c);
-+ while (((c = yylex(0)) != '\n') && (yylval.cp != NULL)) {
-+ temp_argc++;
-+ temp_argv = xrealloc(temp_argv, sizeof(char *) * (temp_argc+1));
-+ /* parse $ var if passed argument is a variable */
-+ if (yylval.cp[0] == '$') {
-+ struct var *arg = lookup(&yylval.cp[1]);
-+ temp_argv[temp_argc] = xstrdup(arg->value);
-+ //fprintf(stderr, "arg->value=%s\n", arg->value);
-+ } else {
-+ temp_argv[temp_argc] = xstrdup(yylval.cp);
-+ //fprintf(stderr, "ARG:%s\n", yylval.cp);
-+ }
-+ }
-+ /*
-+ global_env.iop->argp->afpos--;
-+ global_env.iop->argp->afbuf->bufp--;
-+ */
-+ dolc = temp_argc;
-+ dolv = temp_argv;
-+ //unget(c);
-+ //while ((c = my_getc(0)) == ' ' || c == '\t') /* Skip whitespace */
-+ // continue;
-+ //unget(c);
-+ frame[cur_frame].saved_return_addr = global_env.iop->argp->afpos;
-+
-+ /* get function begin address and execute this function */
-+
-+ bp = global_env.iop->argp->afbuf;
-+ bp->bufp = &(bp->buf[f->begin_addr]);
-+ global_env.iop->argp->afpos = f->begin_addr;
-+
-+ /* func_finished=0 means we are in a function and func_finished=1 means we are executing a function */
-+ func_finished = 0;
-+
-+ //fprintf(stderr, "exec function %s\n", f->name);
-+ KSDBG_PRINT_FUNCNAME;
-+ for (;;) {
-+ //fprintf(stderr, "afpos=%d,%s\n", global_env.iop->argp->afpos, yylval.cp);
-+ if (global_env.iop->argp->afpos == f->end_addr)
-+ break;
-+ onecommand();
-+ /* we return from a function, when func_finished = 1 */
-+ if (func_finished)
-+ break;
-+ }
-+
-+ {
-+ //fprintf(stderr, "%s is finished @%d!\n", f->name, global_env.iop->argp->afpos);
-+ int ret = frame[cur_frame].saved_return_addr;
-+ /* workaround code for \n */
-+ if (dolc)
-+ ret--;
-+ /* get return address from current frame and jump to */
-+ global_env.iop->argp->afpos = ret;
-+ global_env.iop->argp->afbuf->bufp = &(global_env.iop->argp->afbuf->buf[ret]);
-+ }
-+ /*
-+ fprintf(stderr, "******** after execution ********************\n");
-+ fprintf(stderr, " %s \n############# %d\n", global_env.iop->argp->afbuf->bufp, ret);
-+ fprintf(stderr, "*******************************\n");
-+ */
-+ /* we return to previous frame */
-+ cur_frame--;
-+ /* free some space occupied by argument */
-+ while (dolc--)
-+ free(dolv[dolc]);
-+ free(dolv);
-+
-+ /* recover argument for last function */
-+ dolv = frame[cur_frame].argv;
-+ dolc = frame[cur_frame].argc;
-+ /* If we are not in the outest frame, we should set
-+ * func_finished to 0 that means we still in some function */
-+ if (cur_frame != 0)
-+ func_finished = 0;
-+} //funccode:end
-
- static int collect(int c, int c1)
- {
-@@ -2601,6 +2839,10 @@ static int execute(struct op *t, int *pi
- execute(t->right->right, pin, pout, /* no_fork: */ 0);
- }
- break;
-+ case TFUNC: //funccode:start
-+ break;
-+ case TRETURN:
-+ break; //funccode:end
-
- case TCASE:
- cp = evalstr(t->str, DOSUB | DOTRIM);