bc: convert to "G trick" - this returns bc to zero bss increase
[oweals/busybox.git] / coreutils / paste.c
index 54e15c9a0991830c2afb367713cb3908a23aa5fb..52f67f9513d05e01708267c4dd631db1a6d9c7bf 100644 (file)
@@ -7,11 +7,11 @@
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 //config:config PASTE
-//config:      bool "paste"
+//config:      bool "paste (4.5 kb)"
 //config:      default y
 //config:      help
-//config:        paste is used to paste lines of different files together
-//config:        and write the result to stdout
+//config:      paste is used to paste lines of different files together
+//config:      and write the result to stdout
 
 //applet:IF_PASTE(APPLET_NOEXEC(paste, paste, BB_DIR_USR_BIN, BB_SUID_DROP, paste))
 
@@ -36,11 +36,12 @@ static void paste_files(FILE** files, int file_cnt, char* delims, int del_cnt)
 {
        char *line;
        char delim;
-       int del_idx = 0;
        int active_files = file_cnt;
        int i;
 
        while (active_files > 0) {
+               int del_idx = 0;
+
                for (i = 0; i < file_cnt; ++i) {
                        if (files[i] == NULL)
                                continue;
@@ -70,10 +71,11 @@ static void paste_files_separate(FILE** files, char* delims, int del_cnt)
 {
        char *line, *next_line;
        char delim;
-       int del_idx = 0;
        int i;
 
        for (i = 0; files[i]; ++i) {
+               int del_idx = 0;
+
                line = NULL;
                while ((next_line = xmalloc_fgetline(files[i])) != NULL) {
                        if (line) {
@@ -125,7 +127,7 @@ int paste_main(int argc UNUSED_PARAM, char **argv)
                (--argv)[0] = (char*) "-";
        for (i = 0; argv[i]; ++i) {
                argv[i] = (void*) fopen_or_warn_stdin(argv[i]);
-               if (!argv[i])
+               if (!argv[i])
                        xfunc_die();
        }