summaryrefslogtreecommitdiff
path: root/bin/yes/yes.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/yes/yes.c')
-rw-r--r--bin/yes/yes.c22
1 files changed, 22 insertions, 0 deletions
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;
+}