comm: almost total rewrite; add testsuite
[oweals/busybox.git] / coreutils / yes.c
index 5529eab143e4c4f655485e3e43ecaebbfd0b74de..9d3f675501d5b41f525397532fa459b4432d47e8 100644 (file)
 
 /* This is a NOFORK applet. Be very careful! */
 
-int yes_main(int argc, char **argv);
+int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int yes_main(int argc, char **argv)
 {
-       char **first_arg;
+       char **pp;
 
        argv[0] = (char*)"y";
        if (argc != 1) {
                ++argv;
        }
 
-       first_arg = argv;
        do {
+               pp = argv;
                while (1) {
-                       fputs(*argv, stdout);
-                       if (!*++argv)
+                       fputs(*pp, stdout);
+                       if (!*++pp)
                                break;
                        putchar(' ');
                }
-               argv = first_arg;
        } while (putchar('\n') != EOF);
 
        bb_perror_nomsg_and_die();