aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-08-22 17:47:09 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-08-22 17:47:09 +0000
commit99b12543cf14681d32d4d3a57695458dadc89baf (patch)
treea19aaa212ae05f8a8d4746b4d54d91fcd1f2f87a /archival
parent242e3b6bdee92f436bac418d4a0385055fcd7a41 (diff)
downloadbusybox-99b12543cf14681d32d4d3a57695458dadc89baf.tar.gz
Run through ident, fix comments
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/get_header_tar.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 668fa5a2c..1ba37d6d7 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -20,24 +20,24 @@
#include "unarchive.h"
#include "libbb.h"
-file_header_t *get_header_tar(FILE *tar_stream)
+file_header_t *get_header_tar(FILE * tar_stream)
{
union {
unsigned char raw[512];
struct {
- char name[100]; /* 0-99 */
- char mode[8]; /* 100-107 */
- char uid[8]; /* 108-115 */
- char gid[8]; /* 116-123 */
- char size[12]; /* 124-135 */
- char mtime[12]; /* 136-147 */
- char chksum[8]; /* 148-155 */
- char typeflag; /* 156-156 */
+ char name[100]; /* 0-99 */
+ char mode[8]; /* 100-107 */
+ char uid[8]; /* 108-115 */
+ char gid[8]; /* 116-123 */
+ char size[12]; /* 124-135 */
+ char mtime[12]; /* 136-147 */
+ char chksum[8]; /* 148-155 */
+ char typeflag; /* 156-156 */
char linkname[100]; /* 157-256 */
- char magic[6]; /* 257-262 */
+ char magic[6]; /* 257-262 */
char version[2]; /* 263-264 */
- char uname[32]; /* 265-296 */
- char gname[32]; /* 297-328 */
+ char uname[32]; /* 265-296 */
+ char gname[32]; /* 297-328 */
char devmajor[8]; /* 329-336 */
char devminor[8]; /* 337-344 */
char prefix[155]; /* 345-499 */
@@ -55,8 +55,7 @@ file_header_t *get_header_tar(FILE *tar_stream)
if (fread(tar.raw, 1, 512, tar_stream) != 512) {
/* Unfortunatly its common for tar files to have all sorts of
* trailing garbage, fail silently */
-// error_msg("Couldnt read header");
- return(NULL);
+ return (NULL);
}
archive_offset += 512;
@@ -67,25 +66,25 @@ file_header_t *get_header_tar(FILE *tar_stream)
#ifdef CONFIG_FEATURE_TAR_OLD_FORMAT
if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
#endif
- return(NULL);
+ return (NULL);
}
/* If there is no filename its an empty header, skip it */
if (tar.formated.name[0] == 0) {
- return(NULL);
+ return (NULL);
}
/* Do checksum on headers */
- for (i = 0; i < 148 ; i++) {
+ for (i = 0; i < 148; i++) {
sum += tar.raw[i];
}
sum += ' ' * 8;
- for (i = 156; i < 512 ; i++) {
+ for (i = 156; i < 512; i++) {
sum += tar.raw[i];
}
if (sum != strtol(tar.formated.chksum, NULL, 8)) {
error_msg("Invalid tar header checksum");
- return(NULL);
+ return (NULL);
}
/* convert to type'ed variables */
@@ -93,44 +92,45 @@ file_header_t *get_header_tar(FILE *tar_stream)
if (tar.formated.prefix[0] == 0) {
tar_entry->name = xstrdup(tar.formated.name);
} else {
- tar_entry->name = concat_path_file(tar.formated.prefix, tar.formated.name);
+ tar_entry->name =
+ concat_path_file(tar.formated.prefix, tar.formated.name);
}
tar_entry->mode = strtol(tar.formated.mode, NULL, 8);
#ifdef CONFIG_FEATURE_TAR_OLD_FORMAT
switch (tar.formated.typeflag) {
- case 0:
- tar_entry->mode |= S_IFREG;
- break;
- case 1:
- error_msg("internal hard link not handled\n");
- break;
- case 2:
- tar_entry->mode |= S_IFLNK;
- break;
- case 3:
- tar_entry->mode |= S_IFCHR;
- break;
- case 4:
- tar_entry->mode |= S_IFBLK;
- break;
- case 5:
- tar_entry->mode |= S_IFDIR;
- break;
- case 6:
- tar_entry->mode |= S_IFIFO;
- break;
+ case 0:
+ tar_entry->mode |= S_IFREG;
+ break;
+ case 1:
+ error_msg("internal hard link not handled\n");
+ break;
+ case 2:
+ tar_entry->mode |= S_IFLNK;
+ break;
+ case 3:
+ tar_entry->mode |= S_IFCHR;
+ break;
+ case 4:
+ tar_entry->mode |= S_IFBLK;
+ break;
+ case 5:
+ tar_entry->mode |= S_IFDIR;
+ break;
+ case 6:
+ tar_entry->mode |= S_IFIFO;
+ break;
}
#endif
- tar_entry->uid = strtol(tar.formated.uid, NULL, 8);
- tar_entry->gid = strtol(tar.formated.gid, NULL, 8);
- tar_entry->size = strtol(tar.formated.size, NULL, 8);
+ tar_entry->uid = strtol(tar.formated.uid, NULL, 8);
+ tar_entry->gid = strtol(tar.formated.gid, NULL, 8);
+ tar_entry->size = strtol(tar.formated.size, NULL, 8);
tar_entry->mtime = strtol(tar.formated.mtime, NULL, 8);
- tar_entry->link_name = strlen(tar.formated.linkname) ?
- xstrdup(tar.formated.linkname) : NULL;
- tar_entry->device = (strtol(tar.formated.devmajor, NULL, 8) << 8) +
+ tar_entry->link_name =
+ strlen(tar.formated.linkname) ? xstrdup(tar.formated.linkname) : NULL;
+ tar_entry->device =
+ (strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8);
- return(tar_entry);
+ return (tar_entry);
}
-