hexdump: accept hex numbers in -n, closes 16195
[busybox-git.git] / coreutils / yes.c
blobe04ad3ac0a24ba1dda2b0da602dfdd772d7550f5
1 /* vi: set sw=4 ts=4: */
2 /*
3 * yes implementation for busybox
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */
9 /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
11 * Size reductions and removed redundant applet name prefix from error messages.
13 //config:config YES
14 //config: bool "yes (1.5 kb)"
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'.
20 //applet:IF_YES(APPLET_NOEXEC(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
21 /* was NOFORK, but then yes can't be ^C'ed if run by hush */
23 //kbuild:lib-$(CONFIG_YES) += yes.o
25 /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
27 //usage:#define yes_trivial_usage
28 //usage: "[STRING]"
29 //usage:#define yes_full_usage "\n\n"
30 //usage: "Repeatedly print a line with STRING, or 'y'"
32 #include "libbb.h"
34 int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
35 int yes_main(int argc UNUSED_PARAM, char **argv)
37 char **pp;
39 argv[0] = (char*)"y";
40 if (argv[1])
41 ++argv;
43 do {
44 pp = argv;
45 while (1) {
46 fputs_stdout(*pp);
47 if (!*++pp)
48 break;
49 putchar(' ');
51 } while (putchar('\n') != EOF);
53 bb_perror_nomsg_and_die();