projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewrote mkdir (and touched lots of things in the process).
[oweals/busybox.git]
/
coreutils
/
yes.c
diff --git
a/coreutils/yes.c
b/coreutils/yes.c
index 96d6257d0c5b4d928cd4bd336df85b10ff89fa9f..7d9596d0bf72156b53426ec0013254a6fdd127a1 100644
(file)
--- a/
coreutils/yes.c
+++ b/
coreutils/yes.c
@@
-1,3
+1,4
@@
+/* vi: set sw=4 ts=4: */
/*
* Mini yes implementation for busybox
*
/*
* Mini yes implementation for busybox
*
@@
-19,23
+20,34
@@
*
*/
*
*/
-#include "internal.h"
+/* getopt not needed */
+
#include <stdio.h>
#include <stdio.h>
+#include <stdlib.h>
+#include "busybox.h"
-extern int yes_main(int argc, char **argv) {
+extern int yes_main(int argc, char **argv)
+{
int i;
int i;
- if (argc == 1)
+
+ if (argc >= 2 && *argv[1] == '-')
+ show_usage();
+
+ if (argc == 1) {
while (1)
while (1)
- if (puts
("y") == EOF) {
- perror
("yes");
-
exit(FALSE)
;
+ if (puts("y") == EOF) {
+ perror("yes");
+
return EXIT_FAILURE
;
}
}
+ }
while (1)
for (i = 1; i < argc; i++)
while (1)
for (i = 1; i < argc; i++)
- if (fputs (argv[i], stdout) == EOF || putchar (i == argc - 1 ? '\n' : ' ') == EOF) {
- perror ("yes");
- exit(FALSE);
+ if (fputs(argv[i], stdout) == EOF
+ || putchar(i == argc - 1 ? '\n' : ' ') == EOF) {
+ perror("yes");
+ return EXIT_FAILURE;
}
}
- exit(TRUE);
+
+ return EXIT_SUCCESS;
}
}