diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-11-10 19:27:58 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-11-10 19:27:58 +0000 |
commit | 5556c1874b498afcb3b07ebeeed0beed4a97fd68 (patch) | |
tree | 00bb7039b7d7f7e9b854446ed4423655a4cb37d4 | |
parent | 3e2bb288da337953dee3cf60382994d8b47b69a5 (diff) | |
download | busybox-w32-5556c1874b498afcb3b07ebeeed0beed4a97fd68.tar.gz busybox-w32-5556c1874b498afcb3b07ebeeed0beed4a97fd68.tar.bz2 busybox-w32-5556c1874b498afcb3b07ebeeed0beed4a97fd68.zip |
Maybe works now...
-Erik
-rw-r--r-- | archival/tar.c | 83 | ||||
-rw-r--r-- | tar.c | 83 |
2 files changed, 84 insertions, 82 deletions
diff --git a/archival/tar.c b/archival/tar.c index 9ad41bea8..c23805993 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -40,10 +40,10 @@ | |||
40 | * Some time this should be integrated a bit better, but this | 40 | * Some time this should be integrated a bit better, but this |
41 | * does the job for now. | 41 | * does the job for now. |
42 | */ | 42 | */ |
43 | #undef FALSE | 43 | //#undef FALSE |
44 | #undef TRUE | 44 | //#undef TRUE |
45 | #define FALSE ((int) 0) | 45 | //#define FALSE ((int) 0) |
46 | #define TRUE ((int) 1) | 46 | //#define TRUE ((int) 1) |
47 | 47 | ||
48 | 48 | ||
49 | static const char tar_usage[] = | 49 | static const char tar_usage[] = |
@@ -96,18 +96,18 @@ typedef struct { | |||
96 | /* | 96 | /* |
97 | * Static data. | 97 | * Static data. |
98 | */ | 98 | */ |
99 | static int listFlag; | 99 | static int listFlag; // |
100 | static int extractFlag; | 100 | static int extractFlag; // |
101 | static int createFlag; | 101 | static int createFlag; // |
102 | static int verboseFlag; | 102 | static int verboseFlag; // |
103 | static int tostdoutFlag; | 103 | static int tostdoutFlag; // |
104 | 104 | ||
105 | static int inHeader; | 105 | static int inHeader; // <- check me |
106 | static int badHeader; | 106 | static int badHeader; // |
107 | static int errorFlag; | 107 | static int errorFlag; // |
108 | static int skipFileFlag; | 108 | static int skipFileFlag; // |
109 | static int warnedRoot; | 109 | static int warnedRoot; // |
110 | static int eofFlag; | 110 | static int eofFlag; // |
111 | static long dataCc; | 111 | static long dataCc; |
112 | static int outFd; | 112 | static int outFd; |
113 | static char outName[TAR_NAME_SIZE]; | 113 | static char outName[TAR_NAME_SIZE]; |
@@ -136,7 +136,7 @@ static void readHeader (const TarHeader * hp, | |||
136 | /* | 136 | /* |
137 | * Local procedures to save files into a tar file. | 137 | * Local procedures to save files into a tar file. |
138 | */ | 138 | */ |
139 | static void saveFile (const char *fileName, int seeLinks); | 139 | static void saveFile (const char *fileName, int seeLinks); // |
140 | 140 | ||
141 | static void saveRegularFile (const char *fileName, | 141 | static void saveRegularFile (const char *fileName, |
142 | const struct stat *statbuf); | 142 | const struct stat *statbuf); |
@@ -145,13 +145,13 @@ static void saveDirectory (const char *fileName, | |||
145 | const struct stat *statbuf); | 145 | const struct stat *statbuf); |
146 | 146 | ||
147 | static int wantFileName (const char *fileName, | 147 | static int wantFileName (const char *fileName, |
148 | int fileCount, char **fileTable); | 148 | int fileCount, char **fileTable); // |
149 | 149 | ||
150 | static void writeHeader (const char *fileName, const struct stat *statbuf); | 150 | static void writeHeader (const char *fileName, const struct stat *statbuf); |
151 | 151 | ||
152 | static void writeTarFile (int fileCount, char **fileTable); | 152 | static void writeTarFile (int fileCount, char **fileTable); |
153 | static void writeTarBlock (const char *buf, int len); | 153 | static void writeTarBlock (const char *buf, int len); |
154 | static int putOctal (char *cp, int len, long value); | 154 | static int putOctal (char *cp, int len, long value); // |
155 | 155 | ||
156 | 156 | ||
157 | extern int tar_main (int argc, char **argv) | 157 | extern int tar_main (int argc, char **argv) |
@@ -230,7 +230,8 @@ extern int tar_main (int argc, char **argv) | |||
230 | /* | 230 | /* |
231 | * Validate the options. | 231 | * Validate the options. |
232 | */ | 232 | */ |
233 | if (extractFlag + listFlag + createFlag != 1) { | 233 | fprintf(stderr, "TRUE=%d FALSE=%d\n", TRUE, FALSE); |
234 | if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { | ||
234 | fprintf (stderr, | 235 | fprintf (stderr, |
235 | "Exactly one of 'c', 'x' or 't' must be specified\n"); | 236 | "Exactly one of 'c', 'x' or 't' must be specified\n"); |
236 | 237 | ||
@@ -241,13 +242,13 @@ extern int tar_main (int argc, char **argv) | |||
241 | * Do the correct type of action supplying the rest of the | 242 | * Do the correct type of action supplying the rest of the |
242 | * command line arguments as the list of files to process. | 243 | * command line arguments as the list of files to process. |
243 | */ | 244 | */ |
244 | if (createFlag) | 245 | if (createFlag==TRUE) |
245 | writeTarFile (argc, argv); | 246 | writeTarFile (argc, argv); |
246 | else | 247 | else |
247 | readTarFile (argc, argv); | 248 | readTarFile (argc, argv); |
248 | if (errorFlag) | 249 | if (errorFlag==TRUE) |
249 | fprintf (stderr, "\n"); | 250 | fprintf (stderr, "\n"); |
250 | exit (errorFlag); | 251 | exit (!errorFlag); |
251 | } | 252 | } |
252 | 253 | ||
253 | 254 | ||
@@ -292,7 +293,7 @@ static void readTarFile (int fileCount, char **fileTable) | |||
292 | * Read blocks from the file until an end of file header block | 293 | * Read blocks from the file until an end of file header block |
293 | * has been seen. (A real end of file from a read is an error.) | 294 | * has been seen. (A real end of file from a read is an error.) |
294 | */ | 295 | */ |
295 | while (!eofFlag) { | 296 | while (eofFlag==FALSE) { |
296 | /* | 297 | /* |
297 | * Read the next block of data if necessary. | 298 | * Read the next block of data if necessary. |
298 | * This will be a large block if possible, which we will | 299 | * This will be a large block if possible, which we will |
@@ -319,7 +320,7 @@ static void readTarFile (int fileCount, char **fileTable) | |||
319 | /* | 320 | /* |
320 | * If we are expecting a header block then examine it. | 321 | * If we are expecting a header block then examine it. |
321 | */ | 322 | */ |
322 | if (inHeader) { | 323 | if (inHeader==TRUE) { |
323 | readHeader ((const TarHeader *) cp, fileCount, fileTable); | 324 | readHeader ((const TarHeader *) cp, fileCount, fileTable); |
324 | 325 | ||
325 | cp += TAR_BLOCK_SIZE; | 326 | cp += TAR_BLOCK_SIZE; |
@@ -419,7 +420,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
419 | checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum)); | 420 | checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum)); |
420 | 421 | ||
421 | if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) { | 422 | if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) { |
422 | if (!badHeader) | 423 | if (badHeader==FALSE) |
423 | fprintf (stderr, "Bad tar header, skipping\n"); | 424 | fprintf (stderr, "Bad tar header, skipping\n"); |
424 | 425 | ||
425 | badHeader = TRUE; | 426 | badHeader = TRUE; |
@@ -455,7 +456,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
455 | while (*name == '/') | 456 | while (*name == '/') |
456 | name++; | 457 | name++; |
457 | 458 | ||
458 | if (!warnedRoot) { | 459 | if (warnedRoot==FALSE) { |
459 | fprintf (stderr, | 460 | fprintf (stderr, |
460 | "Absolute path detected, removing leading slashes\n"); | 461 | "Absolute path detected, removing leading slashes\n"); |
461 | } | 462 | } |
@@ -467,9 +468,9 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
467 | * See if we want this file to be restored. | 468 | * See if we want this file to be restored. |
468 | * If not, then set up to skip it. | 469 | * If not, then set up to skip it. |
469 | */ | 470 | */ |
470 | if (!wantFileName (name, fileCount, fileTable)) { | 471 | if (wantFileName (name, fileCount, fileTable) == FALSE) { |
471 | if (!hardLink && !softLink && S_ISREG (mode)) { | 472 | if (!hardLink && !softLink && S_ISREG (mode)) { |
472 | inHeader = (size == 0); | 473 | inHeader = (size == 0)? TRUE : FALSE; |
473 | dataCc = size; | 474 | dataCc = size; |
474 | } | 475 | } |
475 | 476 | ||
@@ -482,8 +483,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
482 | * This file is to be handled. | 483 | * This file is to be handled. |
483 | * If we aren't extracting then just list information about the file. | 484 | * If we aren't extracting then just list information about the file. |
484 | */ | 485 | */ |
485 | if (!extractFlag) { | 486 | if (extractFlag==FALSE) { |
486 | if (verboseFlag) { | 487 | if (verboseFlag==TRUE) { |
487 | printf ("%s %3d/%-d %9ld %s %s", modeString (mode), | 488 | printf ("%s %3d/%-d %9ld %s %s", modeString (mode), |
488 | uid, gid, size, timeString (mtime), name); | 489 | uid, gid, size, timeString (mtime), name); |
489 | } else | 490 | } else |
@@ -494,7 +495,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
494 | else if (softLink) | 495 | else if (softLink) |
495 | printf (" (symlink to \"%s\")", hp->linkName); | 496 | printf (" (symlink to \"%s\")", hp->linkName); |
496 | else if (S_ISREG (mode)) { | 497 | else if (S_ISREG (mode)) { |
497 | inHeader = (size == 0); | 498 | inHeader = (size == 0)? TRUE : FALSE; |
498 | dataCc = size; | 499 | dataCc = size; |
499 | } | 500 | } |
500 | 501 | ||
@@ -506,7 +507,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
506 | /* | 507 | /* |
507 | * We really want to extract the file. | 508 | * We really want to extract the file. |
508 | */ | 509 | */ |
509 | if (verboseFlag) | 510 | if (verboseFlag==TRUE) |
510 | printf ("x %s\n", name); | 511 | printf ("x %s\n", name); |
511 | 512 | ||
512 | if (hardLink) { | 513 | if (hardLink) { |
@@ -541,7 +542,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
541 | */ | 542 | */ |
542 | createPath (name, 0777); | 543 | createPath (name, 0777); |
543 | 544 | ||
544 | inHeader = (size == 0); | 545 | inHeader = (size == 0)? TRUE : FALSE; |
545 | dataCc = size; | 546 | dataCc = size; |
546 | 547 | ||
547 | /* | 548 | /* |
@@ -587,7 +588,7 @@ static void readData (const char *cp, int count) | |||
587 | * If we aren't extracting files or this file is being | 588 | * If we aren't extracting files or this file is being |
588 | * skipped then do nothing more. | 589 | * skipped then do nothing more. |
589 | */ | 590 | */ |
590 | if (!extractFlag || skipFileFlag) | 591 | if (extractFlag==FALSE || skipFileFlag==TRUE) |
591 | return; | 592 | return; |
592 | 593 | ||
593 | /* | 594 | /* |
@@ -662,7 +663,7 @@ static void writeTarFile (int fileCount, char **fileTable) | |||
662 | * Append each file name into the archive file. | 663 | * Append each file name into the archive file. |
663 | * Follow symbolic links for these top level file names. | 664 | * Follow symbolic links for these top level file names. |
664 | */ | 665 | */ |
665 | while (!errorFlag && (fileCount-- > 0)) { | 666 | while (errorFlag==FALSE && (fileCount-- > 0)) { |
666 | saveFile (*fileTable++, FALSE); | 667 | saveFile (*fileTable++, FALSE); |
667 | } | 668 | } |
668 | 669 | ||
@@ -694,7 +695,7 @@ static void saveFile (const char *fileName, int seeLinks) | |||
694 | int mode; | 695 | int mode; |
695 | struct stat statbuf; | 696 | struct stat statbuf; |
696 | 697 | ||
697 | if (verboseFlag) | 698 | if (verboseFlag==TRUE) |
698 | printf ("a %s\n", fileName); | 699 | printf ("a %s\n", fileName); |
699 | 700 | ||
700 | /* | 701 | /* |
@@ -710,7 +711,7 @@ static void saveFile (const char *fileName, int seeLinks) | |||
710 | * Find out about the file. | 711 | * Find out about the file. |
711 | */ | 712 | */ |
712 | #ifdef S_ISLNK | 713 | #ifdef S_ISLNK |
713 | if (seeLinks) | 714 | if (seeLinks==TRUE) |
714 | status = lstat (fileName, &statbuf); | 715 | status = lstat (fileName, &statbuf); |
715 | else | 716 | else |
716 | #endif | 717 | #endif |
@@ -810,7 +811,7 @@ saveRegularFile (const char *fileName, const struct stat *statbuf) | |||
810 | */ | 811 | */ |
811 | cc = 0; | 812 | cc = 0; |
812 | 813 | ||
813 | if (!sawEof) { | 814 | if (sawEof==FALSE) { |
814 | cc = fullRead (fileFd, data, dataCount); | 815 | cc = fullRead (fileFd, data, dataCount); |
815 | 816 | ||
816 | if (cc < 0) { | 817 | if (cc < 0) { |
@@ -899,7 +900,7 @@ static void saveDirectory (const char *dirName, const struct stat *statbuf) | |||
899 | * Read all of the directory entries and check them, | 900 | * Read all of the directory entries and check them, |
900 | * except for the current and parent directory entries. | 901 | * except for the current and parent directory entries. |
901 | */ | 902 | */ |
902 | while (!errorFlag && ((entry = readdir (dir)) != NULL)) { | 903 | while (errorFlag==FALSE && ((entry = readdir (dir)) != NULL)) { |
903 | if ((strcmp (entry->d_name, ".") == 0) || | 904 | if ((strcmp (entry->d_name, ".") == 0) || |
904 | (strcmp (entry->d_name, "..") == 0)) { | 905 | (strcmp (entry->d_name, "..") == 0)) { |
905 | continue; | 906 | continue; |
@@ -998,7 +999,7 @@ static void writeTarBlock (const char *buf, int len) | |||
998 | /* | 999 | /* |
999 | * If we had a write error before, then do nothing more. | 1000 | * If we had a write error before, then do nothing more. |
1000 | */ | 1001 | */ |
1001 | if (errorFlag) | 1002 | if (errorFlag==TRUE) |
1002 | return; | 1003 | return; |
1003 | 1004 | ||
1004 | /* | 1005 | /* |
@@ -40,10 +40,10 @@ | |||
40 | * Some time this should be integrated a bit better, but this | 40 | * Some time this should be integrated a bit better, but this |
41 | * does the job for now. | 41 | * does the job for now. |
42 | */ | 42 | */ |
43 | #undef FALSE | 43 | //#undef FALSE |
44 | #undef TRUE | 44 | //#undef TRUE |
45 | #define FALSE ((int) 0) | 45 | //#define FALSE ((int) 0) |
46 | #define TRUE ((int) 1) | 46 | //#define TRUE ((int) 1) |
47 | 47 | ||
48 | 48 | ||
49 | static const char tar_usage[] = | 49 | static const char tar_usage[] = |
@@ -96,18 +96,18 @@ typedef struct { | |||
96 | /* | 96 | /* |
97 | * Static data. | 97 | * Static data. |
98 | */ | 98 | */ |
99 | static int listFlag; | 99 | static int listFlag; // |
100 | static int extractFlag; | 100 | static int extractFlag; // |
101 | static int createFlag; | 101 | static int createFlag; // |
102 | static int verboseFlag; | 102 | static int verboseFlag; // |
103 | static int tostdoutFlag; | 103 | static int tostdoutFlag; // |
104 | 104 | ||
105 | static int inHeader; | 105 | static int inHeader; // <- check me |
106 | static int badHeader; | 106 | static int badHeader; // |
107 | static int errorFlag; | 107 | static int errorFlag; // |
108 | static int skipFileFlag; | 108 | static int skipFileFlag; // |
109 | static int warnedRoot; | 109 | static int warnedRoot; // |
110 | static int eofFlag; | 110 | static int eofFlag; // |
111 | static long dataCc; | 111 | static long dataCc; |
112 | static int outFd; | 112 | static int outFd; |
113 | static char outName[TAR_NAME_SIZE]; | 113 | static char outName[TAR_NAME_SIZE]; |
@@ -136,7 +136,7 @@ static void readHeader (const TarHeader * hp, | |||
136 | /* | 136 | /* |
137 | * Local procedures to save files into a tar file. | 137 | * Local procedures to save files into a tar file. |
138 | */ | 138 | */ |
139 | static void saveFile (const char *fileName, int seeLinks); | 139 | static void saveFile (const char *fileName, int seeLinks); // |
140 | 140 | ||
141 | static void saveRegularFile (const char *fileName, | 141 | static void saveRegularFile (const char *fileName, |
142 | const struct stat *statbuf); | 142 | const struct stat *statbuf); |
@@ -145,13 +145,13 @@ static void saveDirectory (const char *fileName, | |||
145 | const struct stat *statbuf); | 145 | const struct stat *statbuf); |
146 | 146 | ||
147 | static int wantFileName (const char *fileName, | 147 | static int wantFileName (const char *fileName, |
148 | int fileCount, char **fileTable); | 148 | int fileCount, char **fileTable); // |
149 | 149 | ||
150 | static void writeHeader (const char *fileName, const struct stat *statbuf); | 150 | static void writeHeader (const char *fileName, const struct stat *statbuf); |
151 | 151 | ||
152 | static void writeTarFile (int fileCount, char **fileTable); | 152 | static void writeTarFile (int fileCount, char **fileTable); |
153 | static void writeTarBlock (const char *buf, int len); | 153 | static void writeTarBlock (const char *buf, int len); |
154 | static int putOctal (char *cp, int len, long value); | 154 | static int putOctal (char *cp, int len, long value); // |
155 | 155 | ||
156 | 156 | ||
157 | extern int tar_main (int argc, char **argv) | 157 | extern int tar_main (int argc, char **argv) |
@@ -230,7 +230,8 @@ extern int tar_main (int argc, char **argv) | |||
230 | /* | 230 | /* |
231 | * Validate the options. | 231 | * Validate the options. |
232 | */ | 232 | */ |
233 | if (extractFlag + listFlag + createFlag != 1) { | 233 | fprintf(stderr, "TRUE=%d FALSE=%d\n", TRUE, FALSE); |
234 | if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { | ||
234 | fprintf (stderr, | 235 | fprintf (stderr, |
235 | "Exactly one of 'c', 'x' or 't' must be specified\n"); | 236 | "Exactly one of 'c', 'x' or 't' must be specified\n"); |
236 | 237 | ||
@@ -241,13 +242,13 @@ extern int tar_main (int argc, char **argv) | |||
241 | * Do the correct type of action supplying the rest of the | 242 | * Do the correct type of action supplying the rest of the |
242 | * command line arguments as the list of files to process. | 243 | * command line arguments as the list of files to process. |
243 | */ | 244 | */ |
244 | if (createFlag) | 245 | if (createFlag==TRUE) |
245 | writeTarFile (argc, argv); | 246 | writeTarFile (argc, argv); |
246 | else | 247 | else |
247 | readTarFile (argc, argv); | 248 | readTarFile (argc, argv); |
248 | if (errorFlag) | 249 | if (errorFlag==TRUE) |
249 | fprintf (stderr, "\n"); | 250 | fprintf (stderr, "\n"); |
250 | exit (errorFlag); | 251 | exit (!errorFlag); |
251 | } | 252 | } |
252 | 253 | ||
253 | 254 | ||
@@ -292,7 +293,7 @@ static void readTarFile (int fileCount, char **fileTable) | |||
292 | * Read blocks from the file until an end of file header block | 293 | * Read blocks from the file until an end of file header block |
293 | * has been seen. (A real end of file from a read is an error.) | 294 | * has been seen. (A real end of file from a read is an error.) |
294 | */ | 295 | */ |
295 | while (!eofFlag) { | 296 | while (eofFlag==FALSE) { |
296 | /* | 297 | /* |
297 | * Read the next block of data if necessary. | 298 | * Read the next block of data if necessary. |
298 | * This will be a large block if possible, which we will | 299 | * This will be a large block if possible, which we will |
@@ -319,7 +320,7 @@ static void readTarFile (int fileCount, char **fileTable) | |||
319 | /* | 320 | /* |
320 | * If we are expecting a header block then examine it. | 321 | * If we are expecting a header block then examine it. |
321 | */ | 322 | */ |
322 | if (inHeader) { | 323 | if (inHeader==TRUE) { |
323 | readHeader ((const TarHeader *) cp, fileCount, fileTable); | 324 | readHeader ((const TarHeader *) cp, fileCount, fileTable); |
324 | 325 | ||
325 | cp += TAR_BLOCK_SIZE; | 326 | cp += TAR_BLOCK_SIZE; |
@@ -419,7 +420,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
419 | checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum)); | 420 | checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum)); |
420 | 421 | ||
421 | if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) { | 422 | if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) { |
422 | if (!badHeader) | 423 | if (badHeader==FALSE) |
423 | fprintf (stderr, "Bad tar header, skipping\n"); | 424 | fprintf (stderr, "Bad tar header, skipping\n"); |
424 | 425 | ||
425 | badHeader = TRUE; | 426 | badHeader = TRUE; |
@@ -455,7 +456,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
455 | while (*name == '/') | 456 | while (*name == '/') |
456 | name++; | 457 | name++; |
457 | 458 | ||
458 | if (!warnedRoot) { | 459 | if (warnedRoot==FALSE) { |
459 | fprintf (stderr, | 460 | fprintf (stderr, |
460 | "Absolute path detected, removing leading slashes\n"); | 461 | "Absolute path detected, removing leading slashes\n"); |
461 | } | 462 | } |
@@ -467,9 +468,9 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
467 | * See if we want this file to be restored. | 468 | * See if we want this file to be restored. |
468 | * If not, then set up to skip it. | 469 | * If not, then set up to skip it. |
469 | */ | 470 | */ |
470 | if (!wantFileName (name, fileCount, fileTable)) { | 471 | if (wantFileName (name, fileCount, fileTable) == FALSE) { |
471 | if (!hardLink && !softLink && S_ISREG (mode)) { | 472 | if (!hardLink && !softLink && S_ISREG (mode)) { |
472 | inHeader = (size == 0); | 473 | inHeader = (size == 0)? TRUE : FALSE; |
473 | dataCc = size; | 474 | dataCc = size; |
474 | } | 475 | } |
475 | 476 | ||
@@ -482,8 +483,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
482 | * This file is to be handled. | 483 | * This file is to be handled. |
483 | * If we aren't extracting then just list information about the file. | 484 | * If we aren't extracting then just list information about the file. |
484 | */ | 485 | */ |
485 | if (!extractFlag) { | 486 | if (extractFlag==FALSE) { |
486 | if (verboseFlag) { | 487 | if (verboseFlag==TRUE) { |
487 | printf ("%s %3d/%-d %9ld %s %s", modeString (mode), | 488 | printf ("%s %3d/%-d %9ld %s %s", modeString (mode), |
488 | uid, gid, size, timeString (mtime), name); | 489 | uid, gid, size, timeString (mtime), name); |
489 | } else | 490 | } else |
@@ -494,7 +495,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
494 | else if (softLink) | 495 | else if (softLink) |
495 | printf (" (symlink to \"%s\")", hp->linkName); | 496 | printf (" (symlink to \"%s\")", hp->linkName); |
496 | else if (S_ISREG (mode)) { | 497 | else if (S_ISREG (mode)) { |
497 | inHeader = (size == 0); | 498 | inHeader = (size == 0)? TRUE : FALSE; |
498 | dataCc = size; | 499 | dataCc = size; |
499 | } | 500 | } |
500 | 501 | ||
@@ -506,7 +507,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
506 | /* | 507 | /* |
507 | * We really want to extract the file. | 508 | * We really want to extract the file. |
508 | */ | 509 | */ |
509 | if (verboseFlag) | 510 | if (verboseFlag==TRUE) |
510 | printf ("x %s\n", name); | 511 | printf ("x %s\n", name); |
511 | 512 | ||
512 | if (hardLink) { | 513 | if (hardLink) { |
@@ -541,7 +542,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
541 | */ | 542 | */ |
542 | createPath (name, 0777); | 543 | createPath (name, 0777); |
543 | 544 | ||
544 | inHeader = (size == 0); | 545 | inHeader = (size == 0)? TRUE : FALSE; |
545 | dataCc = size; | 546 | dataCc = size; |
546 | 547 | ||
547 | /* | 548 | /* |
@@ -587,7 +588,7 @@ static void readData (const char *cp, int count) | |||
587 | * If we aren't extracting files or this file is being | 588 | * If we aren't extracting files or this file is being |
588 | * skipped then do nothing more. | 589 | * skipped then do nothing more. |
589 | */ | 590 | */ |
590 | if (!extractFlag || skipFileFlag) | 591 | if (extractFlag==FALSE || skipFileFlag==TRUE) |
591 | return; | 592 | return; |
592 | 593 | ||
593 | /* | 594 | /* |
@@ -662,7 +663,7 @@ static void writeTarFile (int fileCount, char **fileTable) | |||
662 | * Append each file name into the archive file. | 663 | * Append each file name into the archive file. |
663 | * Follow symbolic links for these top level file names. | 664 | * Follow symbolic links for these top level file names. |
664 | */ | 665 | */ |
665 | while (!errorFlag && (fileCount-- > 0)) { | 666 | while (errorFlag==FALSE && (fileCount-- > 0)) { |
666 | saveFile (*fileTable++, FALSE); | 667 | saveFile (*fileTable++, FALSE); |
667 | } | 668 | } |
668 | 669 | ||
@@ -694,7 +695,7 @@ static void saveFile (const char *fileName, int seeLinks) | |||
694 | int mode; | 695 | int mode; |
695 | struct stat statbuf; | 696 | struct stat statbuf; |
696 | 697 | ||
697 | if (verboseFlag) | 698 | if (verboseFlag==TRUE) |
698 | printf ("a %s\n", fileName); | 699 | printf ("a %s\n", fileName); |
699 | 700 | ||
700 | /* | 701 | /* |
@@ -710,7 +711,7 @@ static void saveFile (const char *fileName, int seeLinks) | |||
710 | * Find out about the file. | 711 | * Find out about the file. |
711 | */ | 712 | */ |
712 | #ifdef S_ISLNK | 713 | #ifdef S_ISLNK |
713 | if (seeLinks) | 714 | if (seeLinks==TRUE) |
714 | status = lstat (fileName, &statbuf); | 715 | status = lstat (fileName, &statbuf); |
715 | else | 716 | else |
716 | #endif | 717 | #endif |
@@ -810,7 +811,7 @@ saveRegularFile (const char *fileName, const struct stat *statbuf) | |||
810 | */ | 811 | */ |
811 | cc = 0; | 812 | cc = 0; |
812 | 813 | ||
813 | if (!sawEof) { | 814 | if (sawEof==FALSE) { |
814 | cc = fullRead (fileFd, data, dataCount); | 815 | cc = fullRead (fileFd, data, dataCount); |
815 | 816 | ||
816 | if (cc < 0) { | 817 | if (cc < 0) { |
@@ -899,7 +900,7 @@ static void saveDirectory (const char *dirName, const struct stat *statbuf) | |||
899 | * Read all of the directory entries and check them, | 900 | * Read all of the directory entries and check them, |
900 | * except for the current and parent directory entries. | 901 | * except for the current and parent directory entries. |
901 | */ | 902 | */ |
902 | while (!errorFlag && ((entry = readdir (dir)) != NULL)) { | 903 | while (errorFlag==FALSE && ((entry = readdir (dir)) != NULL)) { |
903 | if ((strcmp (entry->d_name, ".") == 0) || | 904 | if ((strcmp (entry->d_name, ".") == 0) || |
904 | (strcmp (entry->d_name, "..") == 0)) { | 905 | (strcmp (entry->d_name, "..") == 0)) { |
905 | continue; | 906 | continue; |
@@ -998,7 +999,7 @@ static void writeTarBlock (const char *buf, int len) | |||
998 | /* | 999 | /* |
999 | * If we had a write error before, then do nothing more. | 1000 | * If we had a write error before, then do nothing more. |
1000 | */ | 1001 | */ |
1001 | if (errorFlag) | 1002 | if (errorFlag==TRUE) |
1002 | return; | 1003 | return; |
1003 | 1004 | ||
1004 | /* | 1005 | /* |