diff options
Diffstat (limited to 'bin/yes')
| -rw-r--r-- | bin/yes/Kbuild | 3 | ||||
| -rw-r--r-- | bin/yes/yes.c | 22 |
2 files changed, 25 insertions, 0 deletions
diff --git a/bin/yes/Kbuild b/bin/yes/Kbuild new file mode 100644 index 00000000..be596906 --- /dev/null +++ b/bin/yes/Kbuild @@ -0,0 +1,3 @@ +bin-y := yes +obj-y := yes.o +libs := $(srctree)/lib/libc/libc.a diff --git a/bin/yes/yes.c b/bin/yes/yes.c new file mode 100644 index 00000000..0ddb2da1 --- /dev/null +++ b/bin/yes/yes.c @@ -0,0 +1,22 @@ +#include <string.h> +#include <sys/uio.h> + +int main(int argc, char **argv) +{ + char *str; + struct iovec iov[2]; + + str = (argc > 1) ? argv[1] : "y"; + + iov[0].iov_base = str; + iov[0].iov_len = strlen(str); + + iov[1].iov_base = "\n"; + iov[1].iov_len = 1; + + while (1) { + writev(1, iov, 2); + } + + return 0; +} |
