aboutsummaryrefslogtreecommitdiff
path: root/coreutils/yes.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 15:43:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 15:43:37 +0000
commit99912ca733dd960f5589227fd999c86e73c8e894 (patch)
tree9df947fc08884d498cf76a02204d74b121064134 /coreutils/yes.c
parentff131b980d524a33d8a43cefe65e14f64a43f2da (diff)
downloadbusybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.gz
busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.bz2
busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.zip
audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
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 2611c3e82..569764150 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -16,25 +16,26 @@
16 16
17#include "busybox.h" 17#include "busybox.h"
18 18
19/* This is a NOFORK applet. Be very careful! */
20
19int yes_main(int argc, char **argv); 21int yes_main(int argc, char **argv);
20int yes_main(int argc, char **argv) 22int yes_main(int argc, char **argv)
21{ 23{
22 static const char fmt_str[] = " %s";
23 const char *fmt;
24 char **first_arg; 24 char **first_arg;
25 25
26 *argv = (char*)"y"; 26 argv[0] = (char*)"y";
27 if (argc != 1) { 27 if (argc != 1) {
28 ++argv; 28 ++argv;
29 } 29 }
30 30
31 first_arg = argv; 31 first_arg = argv;
32 do { 32 do {
33 fmt = fmt_str + 1; 33 while (1) {
34 do { 34 fputs(*argv, stdout);
35 printf(fmt, *argv); 35 if (!*++argv)
36 fmt = fmt_str; 36 break;
37 } while (*++argv); 37 putchar(' ');
38 }
38 argv = first_arg; 39 argv = first_arg;
39 } while (putchar('\n') != EOF); 40 } while (putchar('\n') != EOF);
40 41