comparison src/win32/untar.c @ 6425:26b739bc9f1a

[gaim-migrate @ 6933] Warnings and gaim_debugs committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Mon, 11 Aug 2003 18:54:38 +0000
parents a1f9725f4816
children 59ffe137176d
comparison
equal deleted inserted replaced
6424:8e7f1662d802 6425:26b739bc9f1a
74 # define mode_t int 74 # define mode_t int
75 # else 75 # else
76 # include <unistd.h> 76 # include <unistd.h>
77 # endif 77 # endif
78 #endif 78 #endif
79 #include "debug.h"
79 #include "untar.h" 80 #include "untar.h"
80 81
81 extern void debug_printf(char * fmt, ...);
82
83 #define mkdir(a,b) _mkdir((a)) 82 #define mkdir(a,b) _mkdir((a))
84 #define untar_error( error, args... ) debug_printf( "UNTAR ERROR: " ## error ## , ## args ) 83 #define untar_error( error, args... ) gaim_debug(GAIM_DEBUG_ERROR, "untar", ## error ## , ## args )
85 #define untar_warning( warning, args... ) debug_printf( "UNTAR WARNING: " ## warning ## , ## args ) 84 #define untar_warning( warning, args... ) gaim_debug(GAIM_DEBUG_WARNING, "untar", ## warning ## , ## args )
86 85 #define untar_verbose( args... ) gaim_debug(GAIM_DEBUG_INFO, "untar", ## args )
86
87 #define WSIZE 32768 /* size of decompression buffer */ 87 #define WSIZE 32768 /* size of decompression buffer */
88 #define TSIZE 512 /* size of a "tape" block */ 88 #define TSIZE 512 /* size of a "tape" block */
89 #define CR 13 /* carriage-return character */ 89 #define CR 13 /* carriage-return character */
90 #define LF 10 /* line-feed character */ 90 #define LF 10 /* line-feed character */
91 91
490 } 490 }
491 } 491 }
492 492
493 /* list the file */ 493 /* list the file */
494 if (VERBOSE) 494 if (VERBOSE)
495 debug_printf("%c %s", 495 untar_verbose("%c %s",
496 ISREGULAR(*tblk) ? '-' : ("hlcbdp"[(tblk)->type - '1']), 496 ISREGULAR(*tblk) ? '-' : ("hlcbdp"[(tblk)->type - '1']),
497 nbuf); 497 nbuf);
498 else if (!QUIET) 498 else if (!QUIET)
499 debug_printf("%s\n", nbuf); 499 untar_verbose("%s\n", nbuf);
500 500
501 /* if link, then do the link-or-copy thing */ 501 /* if link, then do the link-or-copy thing */
502 if (tblk->type == '1' || tblk->type == '2') 502 if (tblk->type == '1' || tblk->type == '2')
503 { 503 {
504 if (VERBOSE) 504 if (VERBOSE)
505 debug_printf(" -> %s\n", tblk->linkto); 505 untar_verbose(" -> %s\n", tblk->linkto);
506 if (!LISTING) 506 if (!LISTING)
507 linkorcopy(tblk->linkto, nbuf, tblk->type == '2'); 507 linkorcopy(tblk->linkto, nbuf, tblk->type == '2');
508 outsize = 0L; 508 outsize = 0L;
509 return 1; 509 return 1;
510 } 510 }
525 #endif 525 #endif
526 n2 = " created"; 526 n2 = " created";
527 else 527 else
528 n2 = " ignored"; 528 n2 = " ignored";
529 if (VERBOSE) 529 if (VERBOSE)
530 debug_printf("%s\n", n2); 530 untar_verbose("%s\n", n2);
531 return 1; 531 return 1;
532 } 532 }
533 533
534 /* if not a regular file, then skip it */ 534 /* if not a regular file, then skip it */
535 if (!ISREGULAR(*tblk)) 535 if (!ISREGULAR(*tblk))
536 { 536 {
537 if (VERBOSE) 537 if (VERBOSE)
538 debug_printf(" ignored\n"); 538 untar_verbose(" ignored\n");
539 outsize = 0L; 539 outsize = 0L;
540 return 1; 540 return 1;
541 } 541 }
542 542
543 /* print file statistics */ 543 /* print file statistics */
544 if (VERBOSE) 544 if (VERBOSE)
545 { 545 {
546 debug_printf(" (%ld byte%s, %ld tape block%s)\n", 546 untar_verbose(" (%ld byte%s, %ld tape block%s)\n",
547 outsize, 547 outsize,
548 outsize == 1 ? "" : "s", 548 outsize == 1 ? "" : "s",
549 (outsize + TSIZE - 1) / TSIZE, 549 (outsize + TSIZE - 1) / TSIZE,
550 (outsize > 0 && outsize <= TSIZE) ? "" : "s"); 550 (outsize > 0 && outsize <= TSIZE) ? "" : "s");
551 } 551 }