Hi Maxime,

> diff --git a/coreutils/paste.c b/coreutils/paste.c
> new file mode 100644
> index 000000000..ab0ad43c5
> --- /dev/null
> +++ b/coreutils/paste.c
> @@ -0,0 +1,160 @@
> +/* vi: set sw=4 ts=4: */
> +/*
> + * paste.c - implementation of the posix paste command
> + *
> + * Written by Maxime Coste <ma...@kakoune.org>
> + *
> + * Licensed under GPLv2 or later, see file LICENSE in this source tree.
> + */
> +//config:config PASTE
> +//config:      bool "paste"
> +//config:      default y
> +//config:      help
> +//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))
> +
> +//kbuild:lib-$(CONFIG_PASTE) += paste.o
> +
> +//usage:#define paste_trivial_usage
> +//usage:       "[OPTIONS] [FILE]..."
> +//usage:#define paste_full_usage "\n\n"
> +//usage:       "Paste lines from each input files together using a 
> tabulation character\n"
> +//usage:     "\n       -d LIST use delimiters from LIST instead of 
> tabulations"
> +//usage:     "\n       -s      paste lines of each input files separately"
> +//usage:
> +//usage:#define paste_example_usage
> +//usage:       "# write out directory in four columns\n"
> +//usage:       "$ ls | paste - - - -\n"
> +//usage:       "# combine pairs of lines from a file into single lines\n"
> +//usage:       "$ paste -s -d '\t\n' file\n"

Does last example have delimiters correctly escaped?

> diff --git a/testsuite/paste/paste b/testsuite/paste/paste
> new file mode 100644
> index 000000000..349b49d49
> --- /dev/null
> +++ b/testsuite/paste/paste
> @@ -0,0 +1,20 @@
> +cat > foo <<EOF
> +foo1
> +foo2
> +foo3
> +EOF
> +
> +cat > bar <<EOF
> +bar1
> +bar2
> +bar3
> +EOF
> +
> +cat > baz <<EOF
> +foo1   bar1
> +foo2   bar2
> +foo3   bar3
> +EOF

Something has mangled your tabs... (Same in the rest of tests.)

> +busybox paste foo bar > qux
> +diff -u baz qux
> diff --git a/testsuite/paste/paste-back-cuted-lines 
> b/testsuite/paste/paste-back-cuted-lines
> new file mode 100644
> index 000000000..4059b3ec5
> --- /dev/null
> +++ b/testsuite/paste/paste-back-cuted-lines
> @@ -0,0 +1,9 @@
> +cat > foo <<EOF
> +this is the first line
> +this is the second line
> +this is the third line
> +EOF
> +cut -b 1-13 -n foo > foo1
> +cut -b 14- -n foo > foo2
> +paste -d '\0' foo1 foo2 > bar
> +cmp foo bar
> diff --git a/testsuite/paste/paste-multi-stdin 
> b/testsuite/paste/paste-multi-stdin
> new file mode 100644
> index 000000000..834c0c52f
> --- /dev/null
> +++ b/testsuite/paste/paste-multi-stdin
> @@ -0,0 +1,16 @@
> +cat > foo <<EOF
> +line1
> +line2
> +line3
> +line4
> +line5
> +line6
> +EOF
> +
> +cat > bar <<EOF
> +line1  line2   line3
> +line4  line5   line6
> +EOF
> +
> +paste - - - < foo > baz
> +cmp bar baz
> diff --git a/testsuite/paste/paste-pairs b/testsuite/paste/paste-pairs
> new file mode 100644
> index 000000000..90725fa87
> --- /dev/null
> +++ b/testsuite/paste/paste-pairs
> @@ -0,0 +1,16 @@
> +cat > foo <<EOF
> +foo1
> +bar1
> +foo2
> +bar2
> +foo3
> +EOF
> +
> +cat > bar <<EOF
> +foo1   bar1
> +foo2   bar2
> +foo3
> +EOF
> +
> +busybox paste -s -d "\t\n" foo > baz
> +cmp bar baz
> diff --git a/testsuite/paste/paste-separate b/testsuite/paste/paste-separate
> new file mode 100644
> index 000000000..40793fb31
> --- /dev/null
> +++ b/testsuite/paste/paste-separate
> @@ -0,0 +1,19 @@
> +cat > foo <<EOF
> +foo1
> +foo2
> +foo3
> +EOF
> +
> +cat > bar <<EOF
> +bar1
> +bar2
> +bar3
> +EOF
> +
> +cat > baz <<EOF
> +foo1   foo2    foo3
> +bar1   bar2    bar3
> +EOF
> +
> +busybox paste -s foo bar > qux
> +cmp baz qux
> --
> 2.12.0


Cheers,

Xabier Oneca_,,_
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to