updates for supporting Linux kernel build and initrd utilities

cpio: --verbose, --quiet, --to-stdout
test: make 64-bit math enable-able for hush too
dnsdomainname: alias to hostname -d
hostname: support --fqdn, --domain, --file

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-06-26 01:55:45 +02:00
parent 2f86ca1350
commit d30b89c7ee
5 changed files with 115 additions and 35 deletions

View File

@@ -88,9 +88,17 @@ enum {
CPIO_OPT_PRESERVE_MTIME = (1 << 6),
CPIO_OPT_DEREF = (1 << 7),
CPIO_OPT_FILE = (1 << 8),
CPIO_OPT_CREATE = (1 << 9) * ENABLE_FEATURE_CPIO_O,
CPIO_OPT_FORMAT = (1 << 10) * ENABLE_FEATURE_CPIO_O,
CPIO_OPT_PASSTHROUGH = (1 << 11) * ENABLE_FEATURE_CPIO_P,
OPTBIT_FILE = 8,
IF_FEATURE_CPIO_O(OPTBIT_CREATE ,)
IF_FEATURE_CPIO_O(OPTBIT_FORMAT ,)
IF_FEATURE_CPIO_P(OPTBIT_PASSTHROUGH,)
IF_LONG_OPTS( OPTBIT_QUIET ,)
IF_LONG_OPTS( OPTBIT_2STDOUT ,)
CPIO_OPT_CREATE = IF_FEATURE_CPIO_O((1 << OPTBIT_CREATE )) + 0,
CPIO_OPT_FORMAT = IF_FEATURE_CPIO_O((1 << OPTBIT_FORMAT )) + 0,
CPIO_OPT_PASSTHROUGH = IF_FEATURE_CPIO_P((1 << OPTBIT_PASSTHROUGH)) + 0,
CPIO_OPT_QUIET = IF_LONG_OPTS( (1 << OPTBIT_QUIET )) + 0,
CPIO_OPT_2STDOUT = IF_LONG_OPTS( (1 << OPTBIT_2STDOUT )) + 0,
};
#define OPTION_STR "it0uvdmLF:"
@@ -284,6 +292,9 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
"pass-through\0" No_argument "p"
#endif
#endif
"verbose\0" No_argument "v"
"quiet\0" No_argument "\xff"
"to-stdout\0" No_argument "\xfe"
;
#endif
@@ -372,6 +383,8 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
}
if (opt & CPIO_OPT_EXTRACT) {
archive_handle->action_data = data_extract_all;
if (opt & CPIO_OPT_2STDOUT)
archive_handle->action_data = data_extract_to_stdout;
}
if (opt & CPIO_OPT_UNCONDITIONAL) {
archive_handle->ah_flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
@@ -406,7 +419,9 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
while (get_header_cpio(archive_handle) == EXIT_SUCCESS)
continue;
if (archive_handle->ah_priv[2] != (void*) ~(ptrdiff_t)0)
if (archive_handle->ah_priv[2] != (void*) ~(ptrdiff_t)0
&& !(opt & CPIO_OPT_QUIET)
)
printf("%lu blocks\n", (unsigned long)(ptrdiff_t)(archive_handle->ah_priv[2]));
return EXIT_SUCCESS;