summaryrefslogtreecommitdiff
path: root/coreutils/yes.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/yes.c')
-rw-r--r--coreutils/yes.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 2611c3e..5697641 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -16,25 +16,26 @@
#include "busybox.h"
+/* This is a NOFORK applet. Be very careful! */
+
int yes_main(int argc, char **argv);
int yes_main(int argc, char **argv)
{
- static const char fmt_str[] = " %s";
- const char *fmt;
char **first_arg;
- *argv = (char*)"y";
+ argv[0] = (char*)"y";
if (argc != 1) {
++argv;
}
first_arg = argv;
do {
- fmt = fmt_str + 1;
- do {
- printf(fmt, *argv);
- fmt = fmt_str;
- } while (*++argv);
+ while (1) {
+ fputs(*argv, stdout);
+ if (!*++argv)
+ break;
+ putchar(' ');
+ }
argv = first_arg;
} while (putchar('\n') != EOF);