mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
Reorganize listing code.
This commit is contained in:
parent
82cfbad216
commit
6fc2a7d04d
@ -564,8 +564,10 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (listFlag == TRUE) {
|
||||||
/* Special treatment if the list (-t) flag is on */
|
/* Special treatment if the list (-t) flag is on */
|
||||||
if (verboseFlag == TRUE && extractFlag == FALSE) {
|
if (verboseFlag == TRUE) {
|
||||||
int len, len1;
|
int len, len1;
|
||||||
char buf[35];
|
char buf[35];
|
||||||
struct tm *tm = localtime (&(header.mtime));
|
struct tm *tm = localtime (&(header.mtime));
|
||||||
@ -602,16 +604,6 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* List contents if we are supposed to do that */
|
|
||||||
if (verboseFlag == TRUE && listFlag != TRUE) {
|
|
||||||
/* Now the normal listing */
|
|
||||||
FILE *vbFd = stdout;
|
|
||||||
if (tostdoutFlag == TRUE) // If the archive goes to stdout, verbose to stderr
|
|
||||||
vbFd = stderr;
|
|
||||||
fprintf(vbFd, "%s\n", header.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listFlag == TRUE) {
|
|
||||||
printf("%s", header.name);
|
printf("%s", header.name);
|
||||||
if (verboseFlag == TRUE) {
|
if (verboseFlag == TRUE) {
|
||||||
if (header.type==LNKTYPE) /* If this is a link, say so */
|
if (header.type==LNKTYPE) /* If this is a link, say so */
|
||||||
@ -622,6 +614,15 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* List contents if we are supposed to do that */
|
||||||
|
if (verboseFlag == TRUE && extractFlag == TRUE) {
|
||||||
|
/* Now the normal listing */
|
||||||
|
FILE *vbFd = stdout;
|
||||||
|
if (tostdoutFlag == TRUE) // If the archive goes to stdout, verbose to stderr
|
||||||
|
vbFd = stderr;
|
||||||
|
fprintf(vbFd, "%s\n", header.name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove files if we would overwrite them */
|
/* Remove files if we would overwrite them */
|
||||||
if (extractFlag == TRUE && tostdoutFlag == FALSE)
|
if (extractFlag == TRUE && tostdoutFlag == FALSE)
|
||||||
unlink(header.name);
|
unlink(header.name);
|
||||||
|
23
tar.c
23
tar.c
@ -564,8 +564,10 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (listFlag == TRUE) {
|
||||||
/* Special treatment if the list (-t) flag is on */
|
/* Special treatment if the list (-t) flag is on */
|
||||||
if (verboseFlag == TRUE && extractFlag == FALSE) {
|
if (verboseFlag == TRUE) {
|
||||||
int len, len1;
|
int len, len1;
|
||||||
char buf[35];
|
char buf[35];
|
||||||
struct tm *tm = localtime (&(header.mtime));
|
struct tm *tm = localtime (&(header.mtime));
|
||||||
@ -602,16 +604,6 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* List contents if we are supposed to do that */
|
|
||||||
if (verboseFlag == TRUE && listFlag != TRUE) {
|
|
||||||
/* Now the normal listing */
|
|
||||||
FILE *vbFd = stdout;
|
|
||||||
if (tostdoutFlag == TRUE) // If the archive goes to stdout, verbose to stderr
|
|
||||||
vbFd = stderr;
|
|
||||||
fprintf(vbFd, "%s\n", header.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listFlag == TRUE) {
|
|
||||||
printf("%s", header.name);
|
printf("%s", header.name);
|
||||||
if (verboseFlag == TRUE) {
|
if (verboseFlag == TRUE) {
|
||||||
if (header.type==LNKTYPE) /* If this is a link, say so */
|
if (header.type==LNKTYPE) /* If this is a link, say so */
|
||||||
@ -622,6 +614,15 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* List contents if we are supposed to do that */
|
||||||
|
if (verboseFlag == TRUE && extractFlag == TRUE) {
|
||||||
|
/* Now the normal listing */
|
||||||
|
FILE *vbFd = stdout;
|
||||||
|
if (tostdoutFlag == TRUE) // If the archive goes to stdout, verbose to stderr
|
||||||
|
vbFd = stderr;
|
||||||
|
fprintf(vbFd, "%s\n", header.name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove files if we would overwrite them */
|
/* Remove files if we would overwrite them */
|
||||||
if (extractFlag == TRUE && tostdoutFlag == FALSE)
|
if (extractFlag == TRUE && tostdoutFlag == FALSE)
|
||||||
unlink(header.name);
|
unlink(header.name);
|
||||||
|
Loading…
Reference in New Issue
Block a user