summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2015-10-22 13:22:26 +0200
committerDenys Vlasenko2015-10-22 13:22:26 +0200
commit62ae323df0856546754ecfe226fc9bf0dc16bcb8 (patch)
tree65f998cd15feb1ca4a5c65e13550d8ff7a1c72b1
parent6c563e370d0f2f3cf36f3b274e8fe1392ca7125f (diff)
downloadbusybox-62ae323df0856546754ecfe226fc9bf0dc16bcb8.zip
busybox-62ae323df0856546754ecfe226fc9bf0dc16bcb8.tar.gz
tar: implement --version for buildroot
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/tar.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 566ba34..23ac00e 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -992,6 +992,15 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
applet_long_options = tar_longopts;
#endif
#if ENABLE_DESKTOP
+ /* Lie to buildroot when it starts asking stupid questions. */
+ if (argv[1] && strcmp(argv[1], "--version") == 0) {
+ // Output of 'tar --version' examples:
+ // tar (GNU tar) 1.15.1
+ // tar (GNU tar) 1.25
+ // bsdtar 2.8.3 - libarchive 2.8.3
+ puts("tar (busybox) " BB_VER);
+ return 0;
+ }
if (argv[1] && argv[1][0] != '-') {
/* Compat:
* 1st argument without dash handles options with parameters