projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Patch from Matt Kraai to enable proxy support.
[oweals/busybox.git]
/
ar.c
diff --git
a/ar.c
b/ar.c
index 59c3a77545a936f0726de9241d880c72840a9940..88cdd4f9fe18c41a1f379a319d78fd747439dac1 100644
(file)
--- a/
ar.c
+++ b/
ar.c
@@
-35,7
+35,7
@@
#include <sys/types.h>
#include <sys/stat.h>
#include <malloc.h>
#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 */
#define BLOCK_SIZE 60
#define PRESERVE_DATE 1 /* preserve original dates */
@@
-106,7
+106,7
@@
static int checkTarMagic(int srcFd)
headerStart = lseek(srcFd, 0, SEEK_CUR);
lseek(srcFd, (off_t) 257, SEEK_CUR);
headerStart = lseek(srcFd, 0, SEEK_CUR);
lseek(srcFd, (off_t) 257, SEEK_CUR);
- full
R
ead(srcFd, magic, 6);
+ full
_r
ead(srcFd, magic, 6);
lseek(srcFd, headerStart, SEEK_SET);
if (strncmp(magic, "ustar", 5)!=0)
return(FALSE);
lseek(srcFd, headerStart, SEEK_SET);
if (strncmp(magic, "ustar", 5)!=0)
return(FALSE);
@@
-123,7
+123,7
@@
static int readTarHeader(int srcFd, headerL_t *current)
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (full
R
ead(srcFd, (char *) &rawTarHeader, 512) != 512) {
+ if (full
_r
ead(srcFd, (char *) &rawTarHeader, 512) != 512) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
@@
-157,8
+157,8
@@
static int checkArMagic(int srcFd)
char arMagic[8];
headerStart = lseek(srcFd, 0, SEEK_CUR);
char arMagic[8];
headerStart = lseek(srcFd, 0, SEEK_CUR);
- if (full
R
ead(srcFd, arMagic, 8) != 8) {
- error
M
sg("fatal error\n");
+ if (full
_r
ead(srcFd, arMagic, 8) != 8) {
+ error
_m
sg("fatal error\n");
return (FALSE);
}
lseek(srcFd, headerStart, SEEK_SET);
return (FALSE);
}
lseek(srcFd, headerStart, SEEK_SET);
@@
-178,7
+178,7
@@
static int readArEntry(int srcFd, headerL_t *entry)
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (full
R
ead(srcFd, (char *) &rawArHeader, 60) != 60) {
+ if (full
_r
ead(srcFd, (char *) &rawArHeader, 60) != 60) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
@@
-215,7
+215,7
@@
static int readArEntry(int srcFd, headerL_t *entry)
if (entry->size > MAX_NAME_LENGTH)
entry->size = MAX_NAME_LENGTH;
if (entry->size > MAX_NAME_LENGTH)
entry->size = MAX_NAME_LENGTH;
- full
R
ead(srcFd, tempName, entry->size);
+ full
_r
ead(srcFd, tempName, entry->size);
tempName[entry->size-3]='\0';
/* read the second header for this entry */
tempName[entry->size-3]='\0';
/* read the second header for this entry */
@@
-226,7
+226,7
@@
static int readArEntry(int srcFd, headerL_t *entry)
if ((entry->name[0]='/') && (entry->name[1]='0'))
strcpy(entry->name, tempName);
else {
if ((entry->name[0]='/') && (entry->name[1]='0'))
strcpy(entry->name, tempName);
else {
- error
M
sg("Invalid long filename\n");
+ error
_m
sg("Invalid long filename\n");
return(FALSE);
}
}
return(FALSE);
}
}
@@
-343,7
+343,7
@@
extern int ar_main(int argc, char **argv)
usage(ar_usage);
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
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));
optind++;
entry = (headerL_t *) xmalloc(sizeof(headerL_t));
@@
-368,24
+368,24
@@
extern int ar_main(int argc, char **argv)
while(extractList->next != NULL) {
if (funct & EXT_TO_FILE) {
while(extractList->next != NULL) {
if (funct & EXT_TO_FILE) {
- if (is
D
irectory(extractList->name, TRUE, NULL)==FALSE)
- create
P
ath(extractList->name, 0666);
+ if (is
_d
irectory(extractList->name, TRUE, NULL)==FALSE)
+ create
_p
ath(extractList->name, 0666);
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
lseek(srcFd, extractList->offset, SEEK_SET);
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
lseek(srcFd, extractList->offset, SEEK_SET);
- copy
SubFile
(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);
}
if (funct & EXT_TO_STDOUT) {
lseek(srcFd, extractList->offset, SEEK_SET);
- copy
SubFile
(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)
}
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
if (funct & VERBOSE)
- printf("%s %d/%d %8d %s ", mode
S
tring(extractList->mode),
+ printf("%s %d/%d %8d %s ", mode
_s
tring(extractList->mode),
extractList->uid, extractList->gid,
extractList->uid, extractList->gid,
- extractList->size, time
S
tring(extractList->mtime));
+ extractList->size, time
_s
tring(extractList->mtime));
printf("%s\n", extractList->name);
}
extractList=extractList->next;
}
printf("%s\n", extractList->name);
}
extractList=extractList->next;
}
- return
(TRUE)
;
+ return
EXIT_SUCCESS
;
}
}