diff options
Diffstat (limited to 'ar.c')
-rw-r--r-- | ar.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -106,7 +106,7 @@ static int checkTarMagic(int srcFd) | |||
106 | 106 | ||
107 | headerStart = lseek(srcFd, 0, SEEK_CUR); | 107 | headerStart = lseek(srcFd, 0, SEEK_CUR); |
108 | lseek(srcFd, (off_t) 257, SEEK_CUR); | 108 | lseek(srcFd, (off_t) 257, SEEK_CUR); |
109 | fullRead(srcFd, magic, 6); | 109 | full_read(srcFd, magic, 6); |
110 | lseek(srcFd, headerStart, SEEK_SET); | 110 | lseek(srcFd, headerStart, SEEK_SET); |
111 | if (strncmp(magic, "ustar", 5)!=0) | 111 | if (strncmp(magic, "ustar", 5)!=0) |
112 | return(FALSE); | 112 | return(FALSE); |
@@ -123,7 +123,7 @@ static int readTarHeader(int srcFd, headerL_t *current) | |||
123 | off_t initialOffset; | 123 | off_t initialOffset; |
124 | 124 | ||
125 | initialOffset = lseek(srcFd, 0, SEEK_CUR); | 125 | initialOffset = lseek(srcFd, 0, SEEK_CUR); |
126 | if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) { | 126 | if (full_read(srcFd, (char *) &rawTarHeader, 512) != 512) { |
127 | lseek(srcFd, initialOffset, SEEK_SET); | 127 | lseek(srcFd, initialOffset, SEEK_SET); |
128 | return(FALSE); | 128 | return(FALSE); |
129 | } | 129 | } |
@@ -157,8 +157,8 @@ static int checkArMagic(int srcFd) | |||
157 | char arMagic[8]; | 157 | char arMagic[8]; |
158 | 158 | ||
159 | headerStart = lseek(srcFd, 0, SEEK_CUR); | 159 | headerStart = lseek(srcFd, 0, SEEK_CUR); |
160 | if (fullRead(srcFd, arMagic, 8) != 8) { | 160 | if (full_read(srcFd, arMagic, 8) != 8) { |
161 | errorMsg("fatal error\n"); | 161 | error_msg("fatal error\n"); |
162 | return (FALSE); | 162 | return (FALSE); |
163 | } | 163 | } |
164 | lseek(srcFd, headerStart, SEEK_SET); | 164 | lseek(srcFd, headerStart, SEEK_SET); |
@@ -178,7 +178,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
178 | off_t initialOffset; | 178 | off_t initialOffset; |
179 | 179 | ||
180 | initialOffset = lseek(srcFd, 0, SEEK_CUR); | 180 | initialOffset = lseek(srcFd, 0, SEEK_CUR); |
181 | if (fullRead(srcFd, (char *) &rawArHeader, 60) != 60) { | 181 | if (full_read(srcFd, (char *) &rawArHeader, 60) != 60) { |
182 | lseek(srcFd, initialOffset, SEEK_SET); | 182 | lseek(srcFd, initialOffset, SEEK_SET); |
183 | return(FALSE); | 183 | return(FALSE); |
184 | } | 184 | } |
@@ -215,7 +215,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
215 | 215 | ||
216 | if (entry->size > MAX_NAME_LENGTH) | 216 | if (entry->size > MAX_NAME_LENGTH) |
217 | entry->size = MAX_NAME_LENGTH; | 217 | entry->size = MAX_NAME_LENGTH; |
218 | fullRead(srcFd, tempName, entry->size); | 218 | full_read(srcFd, tempName, entry->size); |
219 | tempName[entry->size-3]='\0'; | 219 | tempName[entry->size-3]='\0'; |
220 | 220 | ||
221 | /* read the second header for this entry */ | 221 | /* read the second header for this entry */ |
@@ -226,7 +226,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
226 | if ((entry->name[0]='/') && (entry->name[1]='0')) | 226 | if ((entry->name[0]='/') && (entry->name[1]='0')) |
227 | strcpy(entry->name, tempName); | 227 | strcpy(entry->name, tempName); |
228 | else { | 228 | else { |
229 | errorMsg("Invalid long filename\n"); | 229 | error_msg("Invalid long filename\n"); |
230 | return(FALSE); | 230 | return(FALSE); |
231 | } | 231 | } |
232 | } | 232 | } |
@@ -343,7 +343,7 @@ extern int ar_main(int argc, char **argv) | |||
343 | usage(ar_usage); | 343 | usage(ar_usage); |
344 | 344 | ||
345 | if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) | 345 | if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) |
346 | fatalError("Cannot read %s\n", argv[optind]); | 346 | error_msg_and_die("Cannot read %s\n", argv[optind]); |
347 | 347 | ||
348 | optind++; | 348 | optind++; |
349 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); | 349 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); |
@@ -368,8 +368,8 @@ extern int ar_main(int argc, char **argv) | |||
368 | 368 | ||
369 | while(extractList->next != NULL) { | 369 | while(extractList->next != NULL) { |
370 | if (funct & EXT_TO_FILE) { | 370 | if (funct & EXT_TO_FILE) { |
371 | if (isDirectory(extractList->name, TRUE, NULL)==FALSE) | 371 | if (is_directory(extractList->name, TRUE, NULL)==FALSE) |
372 | createPath(extractList->name, 0666); | 372 | create_path(extractList->name, 0666); |
373 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); | 373 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); |
374 | lseek(srcFd, extractList->offset, SEEK_SET); | 374 | lseek(srcFd, extractList->offset, SEEK_SET); |
375 | copy_file_chunk(srcFd, dstFd, (size_t) extractList->size); | 375 | copy_file_chunk(srcFd, dstFd, (size_t) extractList->size); |
@@ -380,9 +380,9 @@ extern int ar_main(int argc, char **argv) | |||
380 | } | 380 | } |
381 | if ( (funct & DISPLAY) || (funct & VERBOSE)) { | 381 | if ( (funct & DISPLAY) || (funct & VERBOSE)) { |
382 | if (funct & VERBOSE) | 382 | if (funct & VERBOSE) |
383 | printf("%s %d/%d %8d %s ", modeString(extractList->mode), | 383 | printf("%s %d/%d %8d %s ", mode_string(extractList->mode), |
384 | extractList->uid, extractList->gid, | 384 | extractList->uid, extractList->gid, |
385 | extractList->size, timeString(extractList->mtime)); | 385 | extractList->size, time_string(extractList->mtime)); |
386 | printf("%s\n", extractList->name); | 386 | printf("%s\n", extractList->name); |
387 | } | 387 | } |
388 | extractList=extractList->next; | 388 | extractList=extractList->next; |