mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +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;
|
||||
}
|
||||
}
|
||||
|
||||
if (listFlag == TRUE) {
|
||||
/* Special treatment if the list (-t) flag is on */
|
||||
if (verboseFlag == TRUE && extractFlag == FALSE) {
|
||||
if (verboseFlag == TRUE) {
|
||||
int len, len1;
|
||||
char buf[35];
|
||||
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);
|
||||
}
|
||||
}
|
||||
/* 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);
|
||||
if (verboseFlag == TRUE) {
|
||||
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");
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
if (extractFlag == TRUE && tostdoutFlag == FALSE)
|
||||
unlink(header.name);
|
||||
|
23
tar.c
23
tar.c
@ -564,8 +564,10 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (listFlag == TRUE) {
|
||||
/* Special treatment if the list (-t) flag is on */
|
||||
if (verboseFlag == TRUE && extractFlag == FALSE) {
|
||||
if (verboseFlag == TRUE) {
|
||||
int len, len1;
|
||||
char buf[35];
|
||||
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);
|
||||
}
|
||||
}
|
||||
/* 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);
|
||||
if (verboseFlag == TRUE) {
|
||||
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");
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
if (extractFlag == TRUE && tostdoutFlag == FALSE)
|
||||
unlink(header.name);
|
||||
|
Loading…
Reference in New Issue
Block a user