summaryrefslogtreecommitdiff
path: root/coreutils/yes.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-04-10 15:43:37 +0000
committerDenis Vlasenko2007-04-10 15:43:37 +0000
commit99912ca733dd960f5589227fd999c86e73c8e894 (patch)
tree9df947fc08884d498cf76a02204d74b121064134 /coreutils/yes.c
parentff131b980d524a33d8a43cefe65e14f64a43f2da (diff)
downloadbusybox-99912ca733dd960f5589227fd999c86e73c8e894.zip
busybox-99912ca733dd960f5589227fd999c86e73c8e894.tar.gz
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 2611c3e..5697641 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -16,25 +16,26 @@
#include "busybox.h"
+/* This is a NOFORK applet. Be very careful! */
+
int yes_main(int argc, char **argv);
int yes_main(int argc, char **argv)
{
- static const char fmt_str[] = " %s";
- const char *fmt;
char **first_arg;
- *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);
+ while (1) {
+ fputs(*argv, stdout);
+ if (!*++argv)
+ break;
+ putchar(' ');
+ }
argv = first_arg;
} while (putchar('\n') != EOF);