X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Fyes.c;h=7d9596d0bf72156b53426ec0013254a6fdd127a1;hb=ceeff7381929930fe8d7e33543e285d5fdcf1c68;hp=ac67845ac7dadce196de3a37c9ac6fc840e2649d;hpb=e49d5ecbbe51718fa925b6890a735e5937cc2aa2;p=oweals%2Fbusybox.git diff --git a/coreutils/yes.c b/coreutils/yes.c index ac67845ac..7d9596d0b 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c @@ -20,26 +20,34 @@ * */ -#include "internal.h" +/* getopt not needed */ + #include +#include +#include "busybox.h" extern int yes_main(int argc, char **argv) { int i; - if (argc == 1) + if (argc >= 2 && *argv[1] == '-') + show_usage(); + + if (argc == 1) { while (1) if (puts("y") == EOF) { perror("yes"); - exit(FALSE); + return EXIT_FAILURE; } + } while (1) for (i = 1; i < argc; i++) if (fputs(argv[i], stdout) == EOF || putchar(i == argc - 1 ? '\n' : ' ') == EOF) { perror("yes"); - exit(FALSE); + return EXIT_FAILURE; } - exit(TRUE); + + return EXIT_SUCCESS; }