diff options
author | Denis Vlasenko | 2007-04-10 15:43:37 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-04-10 15:43:37 +0000 |
commit | 99912ca733dd960f5589227fd999c86e73c8e894 (patch) | |
tree | 9df947fc08884d498cf76a02204d74b121064134 /coreutils | |
parent | ff131b980d524a33d8a43cefe65e14f64a43f2da (diff) | |
download | busybox-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')
-rw-r--r-- | coreutils/basename.c | 7 | ||||
-rw-r--r-- | coreutils/cat.c | 8 | ||||
-rw-r--r-- | coreutils/chgrp.c | 3 | ||||
-rw-r--r-- | coreutils/chmod.c | 3 | ||||
-rw-r--r-- | coreutils/chown.c | 3 | ||||
-rw-r--r-- | coreutils/chroot.c | 5 | ||||
-rw-r--r-- | coreutils/cp.c | 3 | ||||
-rw-r--r-- | coreutils/cut.c | 3 | ||||
-rw-r--r-- | coreutils/dd.c | 5 | ||||
-rw-r--r-- | coreutils/dirname.c | 6 | ||||
-rw-r--r-- | coreutils/false.c | 3 | ||||
-rw-r--r-- | coreutils/hostid.c | 6 | ||||
-rw-r--r-- | coreutils/length.c | 13 | ||||
-rw-r--r-- | coreutils/ln.c | 3 | ||||
-rw-r--r-- | coreutils/logname.c | 14 | ||||
-rw-r--r-- | coreutils/ls.c | 5 | ||||
-rw-r--r-- | coreutils/mkdir.c | 8 | ||||
-rw-r--r-- | coreutils/mkfifo.c | 6 | ||||
-rw-r--r-- | coreutils/pwd.c | 7 | ||||
-rw-r--r-- | coreutils/rm.c | 8 | ||||
-rw-r--r-- | coreutils/rmdir.c | 10 | ||||
-rw-r--r-- | coreutils/seq.c | 19 | ||||
-rw-r--r-- | coreutils/sleep.c | 16 | ||||
-rw-r--r-- | coreutils/sort.c | 3 | ||||
-rw-r--r-- | coreutils/sync.c | 4 | ||||
-rw-r--r-- | coreutils/test.c | 7 | ||||
-rw-r--r-- | coreutils/true.c | 3 | ||||
-rw-r--r-- | coreutils/tty.c | 6 | ||||
-rw-r--r-- | coreutils/usleep.c | 5 | ||||
-rw-r--r-- | coreutils/whoami.c | 9 | ||||
-rw-r--r-- | coreutils/yes.c | 17 |
31 files changed, 124 insertions, 94 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c index 46f7122..f4307d6 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c @@ -20,11 +20,10 @@ * 3) Save some space by using strcmp(). Calling strncmp() here was silly. */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int basename_main(int argc, char **argv); int basename_main(int argc, char **argv) { @@ -47,5 +46,5 @@ int basename_main(int argc, char **argv) puts(s); - fflush_stdout_and_exit(EXIT_SUCCESS); + return fflush(stdout); } diff --git a/coreutils/cat.c b/coreutils/cat.c index 7bab325..eb141dc 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c @@ -12,17 +12,23 @@ #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + + int bb_cat(char **argv) { static const char *const argv_dash[] = { "-", NULL }; + FILE *f; int retval = EXIT_SUCCESS; - if (!*argv) argv = (char**) &argv_dash; + if (!*argv) + argv = (char**) &argv_dash; do { f = fopen_or_warn_stdin(*argv); if (f) { + /* This is not an xfunc - never exits */ off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); fclose_if_not_stdin(f); if (r >= 0) diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index cfb8c15..48014ec 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c @@ -13,6 +13,9 @@ #include "busybox.h" +/* This is a NOEXEC applet. Be very careful! */ + + int chgrp_main(int argc, char **argv); int chgrp_main(int argc, char **argv) { diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 9a73218..aa36258 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c @@ -16,6 +16,9 @@ #include "busybox.h" +/* This is a NOEXEC applet. Be very careful! */ + + #define OPT_RECURSE (option_mask32 & 1) #define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0)) #define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0)) diff --git a/coreutils/chown.c b/coreutils/chown.c index e64a39c..71ba812 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c @@ -13,6 +13,9 @@ #include "busybox.h" +/* This is a NOEXEC applet. Be very careful! */ + + #define OPT_STR ("Rh" USE_DESKTOP("vcfLHP")) #define BIT_RECURSE 1 #define OPT_RECURSE (option_mask32 & 1) diff --git a/coreutils/chroot.c b/coreutils/chroot.c index fcd70f2..874ee91 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c @@ -27,8 +27,9 @@ int chroot_main(int argc, char **argv) ++argv; if (argc == 2) { argv -= 2; - if (!(*argv = getenv("SHELL"))) { - *argv = (char *) DEFAULT_SHELL; + argv[0] = getenv("SHELL"); + if (!argv[0]) { + argv[0] = (char *) DEFAULT_SHELL; } argv[1] = (char *) "-i"; } diff --git a/coreutils/cp.c b/coreutils/cp.c index a80e0d2..8c09379 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -18,6 +18,9 @@ #include "busybox.h" #include "libcoreutils/coreutils.h" +/* This is a NOEXEC applet. Be very careful! */ + + int cp_main(int argc, char **argv); int cp_main(int argc, char **argv) { diff --git a/coreutils/cut.c b/coreutils/cut.c index 22014fc..b9ea312 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -11,6 +11,9 @@ #include "busybox.h" +/* This is a NOEXEC applet. Be very careful! */ + + /* option vars */ static const char optstring[] = "b:c:f:d:sn"; #define CUT_OPT_BYTE_FLGS (1<<0) diff --git a/coreutils/dd.c b/coreutils/dd.c index 4507b5e..34a325e 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -8,8 +8,11 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include "busybox.h" #include <signal.h> /* For FEATURE_DD_SIGNAL_HANDLING */ +#include "busybox.h" + +/* This is a NOEXEC applet. Be very careful! */ + static const struct suffix_mult dd_suffixes[] = { { "c", 1 }, diff --git a/coreutils/dirname.c b/coreutils/dirname.c index 4ecde31..7c5484b 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c @@ -10,10 +10,10 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ -#include <stdio.h> -#include <stdlib.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int dirname_main(int argc, char **argv); int dirname_main(int argc, char **argv) { @@ -23,5 +23,5 @@ int dirname_main(int argc, char **argv) puts(dirname(argv[1])); - fflush_stdout_and_exit(EXIT_SUCCESS); + return fflush(stdout); } diff --git a/coreutils/false.c b/coreutils/false.c index 2a26e0e..90d6a01 100644 --- a/coreutils/false.c +++ b/coreutils/false.c @@ -10,9 +10,10 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/false.html */ -#include <stdlib.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv); int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) { diff --git a/coreutils/hostid.c b/coreutils/hostid.c index 51a76c6..e14f6ca 100644 --- a/coreutils/hostid.c +++ b/coreutils/hostid.c @@ -9,10 +9,10 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ -#include <stdlib.h> -#include <unistd.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv); int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) { @@ -22,5 +22,5 @@ int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) printf("%lx\n", gethostid()); - fflush_stdout_and_exit(EXIT_SUCCESS); + return fflush(stdout); } diff --git a/coreutils/length.c b/coreutils/length.c index 1dc122c..b3a9d49 100644 --- a/coreutils/length.c +++ b/coreutils/length.c @@ -2,19 +2,18 @@ /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ -#include <stdlib.h> -#include <string.h> -#include <stdio.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int length_main(int argc, char **argv); int length_main(int argc, char **argv) { - if ((argc != 2) || (**(++argv) == '-')) { - bb_show_usage(); + if ((argc != 2) || (**(++argv) == '-')) { + bb_show_usage(); } - printf("%lu\n", (unsigned long)strlen(*argv)); + printf("%u\n", (unsigned)strlen(*argv)); - fflush_stdout_and_exit(EXIT_SUCCESS); + return fflush(stdout); } diff --git a/coreutils/ln.c b/coreutils/ln.c index 7207134..fd4eace 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c @@ -13,6 +13,9 @@ #include "busybox.h" +/* This is a NOEXEC applet. Be very careful! */ + + #define LN_SYMLINK 1 #define LN_FORCE 2 #define LN_NODEREFERENCE 4 diff --git a/coreutils/logname.c b/coreutils/logname.c index 743e229..aba6ce3 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c @@ -20,23 +20,23 @@ * a diagnostic message and an error return. */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int logname_main(int argc, char ATTRIBUTE_UNUSED **argv); int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) { - const char *p; + char buf[128]; if (argc > 1) { bb_show_usage(); } - if ((p = getlogin()) != NULL) { - puts(p); - fflush_stdout_and_exit(EXIT_SUCCESS); + /* Using _r function - avoid pulling in static buffer from libc */ + if (getlogin_r(buf, sizeof(buf)) == 0) { + puts(buf); + return fflush(stdout); } bb_perror_msg_and_die("getlogin"); diff --git a/coreutils/ls.c b/coreutils/ls.c index 34836ee..7bbb19d 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -29,8 +29,11 @@ * 1. requires lstat (BSD) - how do you do it without? */ -#include "busybox.h" #include <getopt.h> +#include "busybox.h" + +/* This is a NOEXEC applet. Be very careful! */ + enum { diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 690e4ab..5a6c9d0 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -19,19 +19,19 @@ /* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support. */ -#include <stdlib.h> -#include <unistd.h> #include <getopt.h> /* struct option */ #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS static const struct option mkdir_long_options[] = { - { "mode", 1, NULL, 'm' }, + { "mode" , 1, NULL, 'm' }, { "parents", 0, NULL, 'p' }, #if ENABLE_SELINUX { "context", 1, NULL, 'Z' }, #endif - { 0, 0, 0, 0 } + { NULL, 0, NULL, 0 } }; #endif diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index 6d8aa41..7dcc50f 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c @@ -10,9 +10,6 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */ -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> #include "busybox.h" #include "libcoreutils/coreutils.h" @@ -24,7 +21,8 @@ int mkfifo_main(int argc, char **argv) mode = getopt_mk_fifo_nod(argc, argv); - if (!*(argv += optind)) { + argv += optind; + if (!*argv) { bb_show_usage(); } diff --git a/coreutils/pwd.c b/coreutils/pwd.c index d96f6a8..a93b8f1 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c @@ -7,10 +7,10 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stdio.h> -#include <stdlib.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int pwd_main(int argc, char **argv); int pwd_main(int argc, char **argv) { @@ -19,7 +19,8 @@ int pwd_main(int argc, char **argv) buf = xrealloc_getcwd_or_warn(NULL); if (buf != NULL) { puts(buf); - fflush_stdout_and_exit(EXIT_SUCCESS); + free(buf); + return fflush(stdout); } return EXIT_FAILURE; diff --git a/coreutils/rm.c b/coreutils/rm.c index 1883fee..6f32e7d 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -15,9 +15,10 @@ * Size reduction. */ -#include <unistd.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int rm_main(int argc, char **argv); int rm_main(int argc, char **argv) { @@ -27,14 +28,15 @@ int rm_main(int argc, char **argv) opt_complementary = "f-i:i-f"; opt = getopt32(argc, argv, "fiRr"); + argv += optind; if(opt & 1) - flags |= FILEUTILS_FORCE; + flags |= FILEUTILS_FORCE; if(opt & 2) flags |= FILEUTILS_INTERACTIVE; if(opt & 12) flags |= FILEUTILS_RECUR; - if (*(argv += optind) != NULL) { + if (*argv != NULL) { do { const char *base = bb_get_last_path_component(*argv); diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 8cbd6f1..7f32530 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c @@ -10,11 +10,12 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */ -#include <stdlib.h> -#include <unistd.h> #include <libgen.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + + int rmdir_main(int argc, char **argv); int rmdir_main(int argc, char **argv) { @@ -24,7 +25,6 @@ int rmdir_main(int argc, char **argv) char *path; flags = getopt32(argc, argv, "p"); - argv += optind; if (!*argv) { @@ -37,7 +37,7 @@ int rmdir_main(int argc, char **argv) /* Record if the first char was a '.' so we can use dirname later. */ do_dot = (*path == '.'); - do { + while (1) { if (rmdir(path) < 0) { bb_perror_msg("'%s'", path); /* Match gnu rmdir msg. */ status = EXIT_FAILURE; @@ -53,7 +53,7 @@ int rmdir_main(int argc, char **argv) } } break; - } while (1); + } } while (*++argv); diff --git a/coreutils/seq.c b/coreutils/seq.c index e81a466..ef884d6 100644 --- a/coreutils/seq.c +++ b/coreutils/seq.c @@ -7,21 +7,22 @@ * Licensed under the GPL v2, see the file LICENSE in this tarball. */ -#include <stdio.h> -#include <stdlib.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + + int seq_main(int argc, char **argv); int seq_main(int argc, char **argv) { - double last, first, increment, i; + double last, increment, i; - first = increment = 1; + i = increment = 1; switch (argc) { case 4: increment = atof(argv[2]); case 3: - first = atof(argv[1]); + i = atof(argv[1]); case 2: last = atof(argv[argc-1]); break; @@ -30,12 +31,10 @@ int seq_main(int argc, char **argv) } /* You should note that this is pos-5.0.91 semantics, -- FK. */ - for (i = first; - (increment > 0 && i <= last) || (increment < 0 && i >=last); - i += increment) - { + while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) { printf("%g\n", i); + i += increment; } - return EXIT_SUCCESS; + return fflush(stdout); } diff --git a/coreutils/sleep.c b/coreutils/sleep.c index b89b0fe..592005b 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c @@ -18,12 +18,12 @@ * time suffixes for seconds, minutes, hours, and days. */ -#include <stdlib.h> -#include <limits.h> -#include <unistd.h> #include "busybox.h" -#ifdef CONFIG_FEATURE_FANCY_SLEEP +/* This is a NOFORK applet. Be very careful! */ + + +#if ENABLE_FEATURE_FANCY_SLEEP static const struct suffix_mult sfx[] = { { "s", 1 }, { "m", 60 }, @@ -36,9 +36,9 @@ static const struct suffix_mult sfx[] = { int sleep_main(int argc, char **argv); int sleep_main(int argc, char **argv) { - unsigned int duration; + unsigned duration; -#ifdef CONFIG_FEATURE_FANCY_SLEEP +#if ENABLE_FEATURE_FANCY_SLEEP if (argc < 2) { bb_show_usage(); @@ -50,7 +50,7 @@ int sleep_main(int argc, char **argv) duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx); } while (*++argv); -#else /* CONFIG_FEATURE_FANCY_SLEEP */ +#else /* FEATURE_FANCY_SLEEP */ if (argc != 2) { bb_show_usage(); @@ -58,7 +58,7 @@ int sleep_main(int argc, char **argv) duration = xatou(argv[1]); -#endif /* CONFIG_FEATURE_FANCY_SLEEP */ +#endif /* FEATURE_FANCY_SLEEP */ if (sleep(duration)) { bb_perror_nomsg_and_die(); diff --git a/coreutils/sort.c b/coreutils/sort.c index dad5429..06a6cbf 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -14,6 +14,9 @@ #include "busybox.h" +/* This is a NOEXEC applet. Be very careful! */ + + /* sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...] sort -c [-bdfinru][-t char][-k keydef][file] diff --git a/coreutils/sync.c b/coreutils/sync.c index 536c57a..e52ab76 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c @@ -9,10 +9,10 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ -#include <stdlib.h> -#include <unistd.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int sync_main(int argc, char **argv); int sync_main(int argc, char **argv) { diff --git a/coreutils/test.c b/coreutils/test.c index d5babef..e9b6276 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -21,12 +21,11 @@ */ #include "busybox.h" -#include <unistd.h> -#include <ctype.h> -#include <errno.h> -#include <string.h> #include <setjmp.h> +/* This is a NOEXEC applet. Be very careful! */ + + /* test(1) accepts the following grammar: oexpr ::= aexpr | aexpr "-o" oexpr ; aexpr ::= nexpr | nexpr "-a" aexpr ; diff --git a/coreutils/true.c b/coreutils/true.c index b2f3a9b..eee6213 100644 --- a/coreutils/true.c +++ b/coreutils/true.c @@ -10,9 +10,10 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */ -#include <stdlib.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int true_main(int argc, char **argv); int true_main(int argc, char **argv) { diff --git a/coreutils/tty.c b/coreutils/tty.c index c28aa33..d4c179f 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c @@ -10,9 +10,6 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/tty.html */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> #include "busybox.h" int tty_main(int argc, char **argv); @@ -31,7 +28,8 @@ int tty_main(int argc, char **argv) retval = 0; - if ((s = ttyname(0)) == NULL) { + s = ttyname(0); + if (s == NULL) { /* According to SUSv3, ttyname can on fail with EBADF or ENOTTY. * We know the file descriptor is good, so failure means not a tty. */ s = "not a tty"; diff --git a/coreutils/usleep.c b/coreutils/usleep.c index 7dd9146..2baf2bc 100644 --- a/coreutils/usleep.c +++ b/coreutils/usleep.c @@ -9,11 +9,10 @@ /* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ -#include <stdlib.h> -#include <limits.h> -#include <unistd.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int usleep_main(int argc, char **argv); int usleep_main(int argc, char **argv) { diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 3185817..25757f6 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -9,11 +9,10 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + int whoami_main(int argc, char **argv); int whoami_main(int argc, char **argv) { @@ -21,6 +20,6 @@ int whoami_main(int argc, char **argv) bb_show_usage(); puts(bb_getpwuid(NULL, geteuid(), -1)); - /* exits on error */ - fflush_stdout_and_exit(EXIT_SUCCESS); + + return fflush(stdout); } 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); |