Add TODO and SUS-compliant yes.

This commit is contained in:
Mid Favila 2021-11-21 16:37:11 -04:00
parent 7f0e2180a3
commit e3bc4a02e2
4 changed files with 192 additions and 0 deletions

91
TODO Normal file
View File

@ -0,0 +1,91 @@
Write a Makefile.
Add octal escape support to echo.
Rework yes(1) to buffer input. This achieves greater throughput per system call.
Write the following utilities:
ar
at/atd
basename
batch(?)
bc
cal
cat
chgrp
chmod
chownn
cksum
cmp
comm
compress(?)
cp
crond/crontab
csplit
cut
dd
df
diff
dirname
du
ed/x
expand(?)
expr
file
find
fold
fuser
grep
head
iconv
id
join
kill
link(?)
ln
locale
localedef
logname
lp(?)
ls
mesg
mkdir
mkfifo
mknod
mktemp
more
mv
newgrp(?)
nice
nl
paste
pathchk(?)
pax
printf
ps
pwd
renice
rm
rmdir
sed
sh
sleep
sort
split
strings
tabs
tail
talk(?)
tee
test
touch
tput
tr
true
tsort
uname
uncompress(?)
unexpand
uniq
wc
who
write(?)
xargs

54
doc/echo.1 Normal file
View File

@ -0,0 +1,54 @@
.TH echo 1 2021-11-21 mp-utils Userland
.SH NAME
echo \- Print argv to stdout.
.PP
.SH SYNOPSIS
.PP
Print the provided arguments to stdout while applying
.SM
SUS
backslash escapes.
.SH DESCRIPTION
.PP
Echo is a standard Unix tool that accepts input from the user and prints it to stdout while applying minimal or no formatting.
.SH OPTIONS
.PP
This implementation of echo accepts no arguments.
.SH ENVIRONMENT
This implementation of echo requires a C89 compiler.
.SH FILES
/usr/src/mp-utils/src/echo.c
.SH CONFORMING TO
.PP
.SM
POSIX
2017,
.SM
SUS
3
.SH NOTES
.PP
Including the following backslash-escapes modifies echo's behavior.
\\a \- Print a BEL.
\\b \- Print a backspace.
\\f \- Print a form-feed.
\\f \- Print a newline.
\\r \- Print a carriage return.
\\t \- Print a tabulation.
\\v \- Print a vertical tabulation.
\\c \- Suppress the trailing newline and ignore further input.
.SH BUGS
.PP
Currently, \\0 (octal) escapes have not been implemented.
.SH SEE ALSO
echo(1p), printf(1)

34
doc/yes.1 Normal file
View File

@ -0,0 +1,34 @@
.TH yes 1 2021-11-21 mp-utils Userland
.SH NAME
yes \- print to stdout forever
.PP
.SH SYNOPSIS
.PP
Print the provided string to stdout forever.
.SH DESCRIPTION
.PP
Yes is a standard Unix tool that accepts input from the user and prints it to stdout repeatedly, or y when no input is provided.
.SH OPTIONS
.PP
This implementation of yes accepts no arguments.
.SH ENVIRONMENT
This implementation of yes requires a C89 compiler.
.SH FILES
/usr/src/mp-utils/src/yes.c
.SH CONFORMING TO
.PP
.SM
POSIX
2017,
.SM
SUS
3
.SH NOTES
.PP
None.
.SH BUGS
.PP
None known.
.SH SEE ALSO
yes(1p)

13
src/yes.c Normal file
View File

@ -0,0 +1,13 @@
#include "common.h"
int main(int argc, char **argv)
{
if(argc > 1)
while(1)
puts(argv[1]);
else
while(1)
puts("y");
return 0;
}