Rename variable that shadows global
This commit is contained in:
parent
be66ad3212
commit
47fd219c95
32
ar.c
32
ar.c
@ -39,9 +39,9 @@ extern int ar_main(int argc, char **argv)
|
|||||||
FILE *src_file = NULL, *dst_file = NULL;
|
FILE *src_file = NULL, *dst_file = NULL;
|
||||||
int funct = 0, opt=0;
|
int funct = 0, opt=0;
|
||||||
|
|
||||||
ar_headers_t *head, *extract_list=NULL;
|
ar_headers_t *head, *ar_extract_list=NULL;
|
||||||
|
|
||||||
extract_list = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
ar_extract_list = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
||||||
head = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
head = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
||||||
@ -87,9 +87,9 @@ extern int ar_main(int argc, char **argv)
|
|||||||
if (strcmp(argv[optind], ar_entry->name) == 0) {
|
if (strcmp(argv[optind], ar_entry->name) == 0) {
|
||||||
ar_headers_t *tmp;
|
ar_headers_t *tmp;
|
||||||
tmp = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
tmp = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||||
*tmp = *extract_list;
|
*tmp = *ar_extract_list;
|
||||||
*extract_list = *ar_entry;
|
*ar_extract_list = *ar_entry;
|
||||||
extract_list->next = tmp;
|
ar_extract_list->next = tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ar_entry=ar_entry->next;
|
ar_entry=ar_entry->next;
|
||||||
@ -97,31 +97,31 @@ extern int ar_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if individual files not found extract all files */
|
/* if individual files not found extract all files */
|
||||||
if (extract_list->next==NULL) {
|
if (ar_extract_list->next==NULL) {
|
||||||
extract_list = head;
|
ar_extract_list = head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find files to extract or display */
|
/* find files to extract or display */
|
||||||
while (extract_list->next != NULL) {
|
while (ar_extract_list->next != NULL) {
|
||||||
if (funct & extract_to_file) {
|
if (funct & extract_to_file) {
|
||||||
dst_file = wfopen(extract_list->name, "w");
|
dst_file = wfopen(ar_extract_list->name, "w");
|
||||||
}
|
}
|
||||||
else if (funct & extract_to_stdout) {
|
else if (funct & extract_to_stdout) {
|
||||||
dst_file = stdout;
|
dst_file = stdout;
|
||||||
}
|
}
|
||||||
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
||||||
fseek(src_file, extract_list->offset, SEEK_SET);
|
fseek(src_file, ar_extract_list->offset, SEEK_SET);
|
||||||
copy_file_chunk(src_file, dst_file, (off_t) extract_list->size);
|
copy_file_chunk(src_file, dst_file, ar_extract_list->size);
|
||||||
}
|
}
|
||||||
if (funct & verbose) {
|
if (funct & verbose) {
|
||||||
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
printf("%s %d/%d %8d %s ", mode_string(ar_extract_list->mode),
|
||||||
extract_list->uid, extract_list->gid,
|
ar_extract_list->uid, ar_extract_list->gid,
|
||||||
(int) extract_list->size, time_string(extract_list->mtime));
|
(int) ar_extract_list->size, time_string(ar_extract_list->mtime));
|
||||||
}
|
}
|
||||||
if ((funct & display) || (funct & verbose)){
|
if ((funct & display) || (funct & verbose)){
|
||||||
printf("%s\n", extract_list->name);
|
printf("%s\n", ar_extract_list->name);
|
||||||
}
|
}
|
||||||
extract_list=extract_list->next;
|
ar_extract_list = ar_extract_list->next;
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ extern int ar_main(int argc, char **argv)
|
|||||||
FILE *src_file = NULL, *dst_file = NULL;
|
FILE *src_file = NULL, *dst_file = NULL;
|
||||||
int funct = 0, opt=0;
|
int funct = 0, opt=0;
|
||||||
|
|
||||||
ar_headers_t *head, *extract_list=NULL;
|
ar_headers_t *head, *ar_extract_list=NULL;
|
||||||
|
|
||||||
extract_list = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
ar_extract_list = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
||||||
head = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
head = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
||||||
@ -87,9 +87,9 @@ extern int ar_main(int argc, char **argv)
|
|||||||
if (strcmp(argv[optind], ar_entry->name) == 0) {
|
if (strcmp(argv[optind], ar_entry->name) == 0) {
|
||||||
ar_headers_t *tmp;
|
ar_headers_t *tmp;
|
||||||
tmp = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
tmp = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||||
*tmp = *extract_list;
|
*tmp = *ar_extract_list;
|
||||||
*extract_list = *ar_entry;
|
*ar_extract_list = *ar_entry;
|
||||||
extract_list->next = tmp;
|
ar_extract_list->next = tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ar_entry=ar_entry->next;
|
ar_entry=ar_entry->next;
|
||||||
@ -97,31 +97,31 @@ extern int ar_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if individual files not found extract all files */
|
/* if individual files not found extract all files */
|
||||||
if (extract_list->next==NULL) {
|
if (ar_extract_list->next==NULL) {
|
||||||
extract_list = head;
|
ar_extract_list = head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find files to extract or display */
|
/* find files to extract or display */
|
||||||
while (extract_list->next != NULL) {
|
while (ar_extract_list->next != NULL) {
|
||||||
if (funct & extract_to_file) {
|
if (funct & extract_to_file) {
|
||||||
dst_file = wfopen(extract_list->name, "w");
|
dst_file = wfopen(ar_extract_list->name, "w");
|
||||||
}
|
}
|
||||||
else if (funct & extract_to_stdout) {
|
else if (funct & extract_to_stdout) {
|
||||||
dst_file = stdout;
|
dst_file = stdout;
|
||||||
}
|
}
|
||||||
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
||||||
fseek(src_file, extract_list->offset, SEEK_SET);
|
fseek(src_file, ar_extract_list->offset, SEEK_SET);
|
||||||
copy_file_chunk(src_file, dst_file, (off_t) extract_list->size);
|
copy_file_chunk(src_file, dst_file, ar_extract_list->size);
|
||||||
}
|
}
|
||||||
if (funct & verbose) {
|
if (funct & verbose) {
|
||||||
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
printf("%s %d/%d %8d %s ", mode_string(ar_extract_list->mode),
|
||||||
extract_list->uid, extract_list->gid,
|
ar_extract_list->uid, ar_extract_list->gid,
|
||||||
(int) extract_list->size, time_string(extract_list->mtime));
|
(int) ar_extract_list->size, time_string(ar_extract_list->mtime));
|
||||||
}
|
}
|
||||||
if ((funct & display) || (funct & verbose)){
|
if ((funct & display) || (funct & verbose)){
|
||||||
printf("%s\n", extract_list->name);
|
printf("%s\n", ar_extract_list->name);
|
||||||
}
|
}
|
||||||
extract_list=extract_list->next;
|
ar_extract_list = ar_extract_list->next;
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user