]> wimlib.net Git - wimlib/commitdiff
wiminfo: consolidate boolean flags into single line
authorEric Biggers <ebiggers3@gmail.com>
Tue, 5 May 2015 03:03:53 +0000 (22:03 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 5 May 2015 04:52:48 +0000 (23:52 -0500)
NEWS
include/wimlib_tchar.h
programs/imagex.c
tests/test-imagex
tests/test-imagex-mount

diff --git a/NEWS b/NEWS
index 55235ead2f5ba9096c4d0ae64c7ac452a72a5f24..0cf5b2df7d6d53edd2218bb54e792e712ce24dcb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ Version 1.8.1-BETA:
        Fixed a bug in the LZX decompressor: malicious input data could cause
        out of bounds writes to memory (since wimlib v1.2.2).
 
+       The output of the 'wiminfo' command now consolidates various boolean
+       flags (such as "Relative path junction") into a single line.
+
        A file can now have both an unnamed data stream ("file contents") and a
        reparse point stream.  Such files can exist as a result of the use of
        certain Windows features, such as offline storage, including "OneDrive".
index 8248d8d953b86c494999d66b7e21ad1f8abdde29..c372b820e1cccd2b801915c5bc854b4abaab6654 100644 (file)
@@ -22,6 +22,7 @@ typedef wchar_t tchar;
 #  define tmemcpy      wmemcpy
 #  define tmemmove     wmemmove
 #  define tmempcpy     wmempcpy
+#  define tstrcat      wcscat
 #  define tstrcpy      wcscpy
 #  define tprintf      wprintf
 #  define tsprintf     swprintf
@@ -80,6 +81,7 @@ typedef char tchar;
 #  define tmemcpy      memcpy
 #  define tmemmove     memmove
 #  define tmempcpy     mempcpy
+#  define tstrcat      strcat
 #  define tstrcpy      strcpy
 #  define tprintf      printf
 #  define tsprintf     sprintf
index 49b5c0f11527834dd51ef88b1d851dc77b492370..762459e84ebc36cd42399c4308dea96b2d6604c1 100644 (file)
@@ -2413,6 +2413,9 @@ static void print_byte_field(const uint8_t field[], size_t len)
 static void
 print_wim_information(const tchar *wimfile, const struct wimlib_wim_info *info)
 {
+       tchar attr_string[256];
+       tchar *p;
+
        tputs(T("WIM Information:"));
        tputs(T("----------------"));
        tprintf(T("Path:           %"TS"\n"), wimfile);
@@ -2428,13 +2431,32 @@ print_wim_information(const tchar *wimfile, const struct wimlib_wim_info *info)
        tprintf(T("Part Number:    %d/%d\n"), info->part_number, info->total_parts);
        tprintf(T("Boot Index:     %d\n"), info->boot_index);
        tprintf(T("Size:           %"PRIu64" bytes\n"), info->total_bytes);
-       tprintf(T("Integrity Info: %"TS"\n"),
-               info->has_integrity_table ? T("yes") : T("no"));
-       tprintf(T("Relative path junction: %"TS"\n"),
-               info->has_rpfix ? T("yes") : T("no"));
-       tprintf(T("Pipable:        %"TS"\n"),
-               info->pipable ? T("yes") : T("no"));
-       tputchar(T('\n'));
+
+       attr_string[0] = T('\0');
+
+       if (info->pipable)
+               tstrcat(attr_string, "Pipable, ");
+
+       if (info->has_integrity_table)
+               tstrcat(attr_string, "Integrity info, ");
+
+       if (info->has_rpfix)
+               tstrcat(attr_string, "Relative path junction, ");
+
+       if (info->resource_only)
+               tstrcat(attr_string, "Resource only, ");
+
+       if (info->metadata_only)
+               tstrcat(attr_string, "Metadata only, ");
+
+       if (info->is_marked_readonly)
+               tstrcat(attr_string, "Readonly, ");
+
+       p = tstrchr(attr_string, '\0');
+       if (p >= &attr_string[2] && p[-1] == T(' ') && p[-2] == T(','))
+               p[-2] = '\0';
+
+       tprintf(T("Attributes:     %"TS"\n\n"), attr_string);
 }
 
 static int
index 78a08182f19f0efdad95420c8e57b438010abaa7..fe931321a760476b63d0d89c3b5793c46f089a02 100755 (executable)
@@ -152,7 +152,7 @@ echo "Testing capture of WIM with integrity table"
 if ! wimcapture dir dir.wim --check; then
        error "Failed to capture WIM with integrity table"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity table on WIM not made"
 fi
 if ! wimapply --check dir.wim tmp; then
@@ -186,14 +186,14 @@ echo "Testing appending WIM image with integrity check"
 if ! wimappend dir2 dir.wim "newname2" --check; then
        error "Appending WIM image failed"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity table not set correctly on image append"
 fi
 echo "Testing appending WIM image with no integrity check"
 if ! wimappend dir2 dir.wim "newname3" --nocheck; then
        error "Appending WIM image failed"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "no"; then
+if wiminfo dir.wim | grep -q Integrity; then
        error "WIM integrity table not removed"
 fi
 # 5 images at this point
@@ -232,7 +232,7 @@ echo "Testing appending directory to empty WIM and making it bootable"
 if ! wimappend dir dir.wim "myname" "mydesc" --check --boot; then
        error "Couldn't append named, described, bootable image to empty WIM with integrity check"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity check not found"
 fi
 if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
index ecb05eaca72ecb1bbdc9bdb8e49bdd3fb9f35fe8..1bde84de180b80581cf89a4c3c7c06d803475995 100755 (executable)
@@ -171,7 +171,7 @@ echo "Unmounting WIM with changes committed and --check"
 if ! imagex_unmount tmp.mnt --commit --check; then
        error "Failed to unmount read-write mounted WIM"
 fi
-if test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" != "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity information was not included"
 fi
 if ! wimapply dir.wim tmp.apply; then