config: deindent all help texts
[oweals/busybox.git] / coreutils / yes.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * yes implementation for busybox
4  *
5  * Copyright (C) 2003  Manuel Novoa III  <mjn3@codepoet.org>
6  *
7  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8  */
9 /* Mar 16, 2003      Manuel Novoa III   (mjn3@codepoet.org)
10  *
11  * Size reductions and removed redundant applet name prefix from error messages.
12  */
13 //config:config YES
14 //config:       bool "yes (956 bytes)"
15 //config:       default y
16 //config:       help
17 //config:       yes is used to repeatedly output a specific string, or
18 //config:       the default string `y'.
19
20 //applet:IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
21
22 //kbuild:lib-$(CONFIG_YES) += yes.o
23
24 /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
25
26 //usage:#define yes_trivial_usage
27 //usage:       "[STRING]"
28 //usage:#define yes_full_usage "\n\n"
29 //usage:       "Repeatedly output a line with STRING, or 'y'"
30
31 #include "libbb.h"
32
33 int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
34 int yes_main(int argc UNUSED_PARAM, char **argv)
35 {
36         char **pp;
37
38         argv[0] = (char*)"y";
39         if (argv[1])
40                 ++argv;
41
42         do {
43                 pp = argv;
44                 while (1) {
45                         fputs(*pp, stdout);
46                         if (!*++pp)
47                                 break;
48                         putchar(' ');
49                 }
50         } while (putchar('\n') != EOF);
51
52         bb_perror_nomsg_and_die();
53 }