X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Fyes.c;h=9d3f675501d5b41f525397532fa459b4432d47e8;hb=eab40e58858d01372b5d74b7330be2d7b1c7fc75;hp=fc6e611e64ce3977f729a6708317066def8d5213;hpb=a41fdf331af344ecd3ec230a072857ea197e1890;p=oweals%2Fbusybox.git diff --git a/coreutils/yes.c b/coreutils/yes.c index fc6e611e6..9d3f67550 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c @@ -14,27 +14,28 @@ * Size reductions and removed redundant applet name prefix from error messages. */ -#include "busybox.h" +#include "libbb.h" +/* This is a NOFORK applet. Be very careful! */ + +int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int yes_main(int argc, char **argv) { - static const char fmt_str[] = " %s"; - const char *fmt; - char **first_arg; + char **pp; - *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); - argv = first_arg; + pp = argv; + while (1) { + fputs(*pp, stdout); + if (!*++pp) + break; + putchar(' '); + } } while (putchar('\n') != EOF); bb_perror_nomsg_and_die();