The unzip command did not provide a way for the caller to get any
information about the uncompressed size. To make it better usable in
scripts, we now store the uncompressed size in the `filesize'
variable, like we do when for example loading a file over the network
or when reading it from a file system. Following that analogy, it is
only consequent to also print the size.
Signed-off-by: Wolfgang Denk <wd@denx.de>
{
unsigned long src, dst;
unsigned long src_len = ~0UL, dst_len = ~0UL;
+ char buf[32];
switch (argc) {
case 4:
return cmd_usage(cmdtp);
}
- return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
+ if (gunzip((void *) dst, dst_len, (void *) src, &src_len) != 0)
+ return 1;
+
+ printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
+ sprintf(buf, "%lX", src_len);
+ setenv("filesize", buf);
+
+ return 0;
}
#endif /* CONFIG_CMD_UNZIP */