#include <sys/types.h>
#include <sys/stat.h>
#include <malloc.h>
-#include "internal.h"
+#include "busybox.h"
#define BLOCK_SIZE 60
#define PRESERVE_DATE 1 /* preserve original dates */
headerStart = lseek(srcFd, 0, SEEK_CUR);
lseek(srcFd, (off_t) 257, SEEK_CUR);
- fullRead(srcFd, magic, 6);
+ full_read(srcFd, magic, 6);
lseek(srcFd, headerStart, SEEK_SET);
if (strncmp(magic, "ustar", 5)!=0)
return(FALSE);
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) {
+ if (full_read(srcFd, (char *) &rawTarHeader, 512) != 512) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
char arMagic[8];
headerStart = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, arMagic, 8) != 8) {
- errorMsg("fatal error\n");
+ if (full_read(srcFd, arMagic, 8) != 8) {
+ error_msg("fatal error\n");
return (FALSE);
}
lseek(srcFd, headerStart, SEEK_SET);
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawArHeader, 60) != 60) {
+ if (full_read(srcFd, (char *) &rawArHeader, 60) != 60) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
if (entry->size > MAX_NAME_LENGTH)
entry->size = MAX_NAME_LENGTH;
- fullRead(srcFd, tempName, entry->size);
+ full_read(srcFd, tempName, entry->size);
tempName[entry->size-3]='\0';
/* read the second header for this entry */
if ((entry->name[0]='/') && (entry->name[1]='0'))
strcpy(entry->name, tempName);
else {
- errorMsg("Invalid long filename\n");
+ error_msg("Invalid long filename\n");
return(FALSE);
}
}
usage(ar_usage);
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
- fatalError("Cannot read %s\n", argv[optind]);
+ error_msg_and_die("Cannot read %s\n", argv[optind]);
optind++;
entry = (headerL_t *) xmalloc(sizeof(headerL_t));
while(extractList->next != NULL) {
if (funct & EXT_TO_FILE) {
- if (isDirectory(extractList->name, TRUE, NULL)==FALSE)
- createPath(extractList->name, 0666);
+ if (is_directory(extractList->name, TRUE, NULL)==FALSE)
+ create_path(extractList->name, 0666);
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
lseek(srcFd, extractList->offset, SEEK_SET);
- copySubFile(srcFd, dstFd, (size_t) extractList->size);
+ copy_file_chunk(srcFd, dstFd, (size_t) extractList->size);
}
if (funct & EXT_TO_STDOUT) {
lseek(srcFd, extractList->offset, SEEK_SET);
- copySubFile(srcFd, fileno(stdout), (size_t) extractList->size);
+ copy_file_chunk(srcFd, fileno(stdout), (size_t) extractList->size);
}
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
if (funct & VERBOSE)
- printf("%s %d/%d %8d %s ", modeString(extractList->mode),
+ printf("%s %d/%d %8d %s ", mode_string(extractList->mode),
extractList->uid, extractList->gid,
- extractList->size, timeString(extractList->mtime));
+ extractList->size, time_string(extractList->mtime));
printf("%s\n", extractList->name);
}
extractList=extractList->next;
}
- return (TRUE);
+ return EXIT_SUCCESS;
}