From: Alan Cox Date: Tue, 30 Dec 2014 11:37:22 +0000 (+0000) Subject: utils: Import yes from ELKS sh-utils and ANSIfy X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=5ffbe50b5df30619cd4b36471103be4b21754a25;p=FUZIX.git utils: Import yes from ELKS sh-utils and ANSIfy --- diff --git a/Applications/util/Makefile b/Applications/util/Makefile index 8308a8bb..5cebabad 100644 --- a/Applications/util/Makefile +++ b/Applications/util/Makefile @@ -82,12 +82,14 @@ SRCS = banner.c \ tr.c \ true.c \ umount.c \ + uname.c \ uniq.c \ uud.c \ uue.c \ wc.c \ which.c \ - whoami.c + whoami.c \ + yes.c OBJS = $(SRCS:.c=.rel) diff --git a/Applications/util/yes.c b/Applications/util/yes.c new file mode 100644 index 00000000..f3cea7b7 --- /dev/null +++ b/Applications/util/yes.c @@ -0,0 +1,25 @@ +/* yes 1.4 - print 'y' or argv[1] continuously. Author: Kees J. Bot + * 15 Apr 1989 + */ +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + char *yes; + int n; + static char y[] = "y"; + + yes = argc == 1 ? y : argv[1]; + + n = strlen(yes); + + yes[n++] = '\n'; + + while (write(1, yes, n) != -1) + /* Do nothing */; + + exit(1); +}