[BusyBox] new tar feature - 2nd patch
Rainer Weikusat
rainer.weikusat at sncag.com
Sun Aug 21 13:49:07 MDT 2005
The previous one contained left-over garbage from
something different.
Index: busybox/archival/Config.in
===================================================================
RCS file: /data/repo/busybox/archival/Config.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- busybox/archival/Config.in 30 Nov 2004 16:02:30 -0000 1.1.1.1
+++ busybox/archival/Config.in 21 Aug 2005 19:11:08 -0000 1.2
@@ -205,6 +205,14 @@
help
Enable use of long options, increases size by about 400 Bytes
+config CONFIG_FEATURE_TAR_ALL_MISSING
+ bool " Report all specified files that were not part of the Archive."
+ default n
+ depends on CONFIG_TAR
+ help
+ Print the names of all archive members tar was asked to operate on
+ but couldn't, because they were not part of the archive to process.
+
config CONFIG_UNCOMPRESS
bool "uncompress"
default n
Index: busybox/archival/tar.c
===================================================================
RCS file: /data/repo/busybox/archival/tar.c,v
retrieving revision 1.1.1.2
retrieving revision 1.5
diff -u -r1.1.1.2 -r1.5
--- busybox/archival/tar.c 1 Jun 2005 08:04:03 -0000 1.1.1.2
+++ busybox/archival/tar.c 21 Aug 2005 19:47:30 -0000 1.5
@@ -646,6 +646,12 @@
# define TAR_OPT_STR_COMPRESS ""
#endif
+#ifdef CONFIG_FEATURE_TAR_ALL_MISSING
+# define signal_error bb_error_msg
+#else
+# define signal_error bb_error_msg_and_die
+#endif
+
static const char tar_options[]="txC:f:Opvk" \
TAR_OPT_STR_CREATE \
TAR_OPT_STR_BZIP2 \
@@ -692,6 +698,9 @@
const char *tar_filename = "-";
unsigned long opt;
unsigned long ctx_flag = 0;
+#ifdef CONFIG_FEATURE_TAR_ALL_MISSING
+ int rc;
+#endif
if (argc < 2) {
bb_show_usage();
@@ -842,6 +851,10 @@
bb_perror_msg_and_die("Couldnt chdir to %s", base_dir);
}
+#ifdef CONFIG_FEATURE_TAR_ALL_MISSING
+ rc = EXIT_SUCCESS;
+#endif
+
#ifdef CONFIG_FEATURE_TAR_CREATE
/* create an archive */
if (opt & CTX_CREATE) {
@@ -874,11 +887,16 @@
while (tar_handle->accept) {
if (find_list_entry(tar_handle->reject, tar_handle->accept->data) == NULL) {
if (find_list_entry(tar_handle->passed, tar_handle->accept->data) == NULL) {
- bb_error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data);
+ signal_error("%s: Not found in archive", tar_handle->accept->data);
+ rc = EXIT_FAILURE;
}
}
tar_handle->accept = tar_handle->accept->link;
}
+
+#ifdef CONFIG_FEATURE_TAR_ALL_MISSING
+ if (rc != EXIT_SUCCESS) bb_error_msg("Error exit delayed from previous errors");
+#endif
}
#ifdef CONFIG_FEATURE_CLEAN_UP
@@ -887,5 +905,9 @@
}
#endif /* CONFIG_FEATURE_CLEAN_UP */
- return(EXIT_SUCCESS);
+#ifdef CONFIG_FEATURE_TAR_ALL_MISSING
+ return rc;
+#else
+ return EXIT_SUCCESS;
+#endif
}
More information about the busybox
mailing list