Minor fixes

This commit is contained in:
Will Nayes 2018-03-22 21:18:45 -05:00
parent e05a487828
commit ab87c6e691
2 changed files with 43 additions and 48 deletions

View File

@ -28,9 +28,7 @@ static void usage();
static char options[128]; static char options[128];
int main(argc, argv) int main(int argc, char **argv)
int argc;
char *argv[];
{ {
int c; int c;
extern int optind; extern int optind;
@ -67,62 +65,62 @@ char *argv[];
break; break;
case 'H': case 'H':
give_wrfileopt(); give_wrfileopt();
(void)fprintf(stderr, "Macunpack specific options:\n"); fprintf(stderr, "Macunpack specific options:\n");
(void)fprintf(stderr, fprintf(stderr,
"-i:\tgive information only, do not unpack\n"); "-i:\tgive information only, do not unpack\n");
(void)fprintf(stderr, "-l:\tgive listing\n"); fprintf(stderr, "-l:\tgive listing\n");
(void)fprintf(stderr, "-v:\tgive verbose listing\n"); fprintf(stderr, "-v:\tgive verbose listing\n");
(void)fprintf(stderr, fprintf(stderr,
"-q:\tquery for every file/folder before unpacking\n"); "-q:\tquery for every file/folder before unpacking\n");
(void)fprintf(stderr, fprintf(stderr,
"-V:\tgive information about this version\n"); "-V:\tgive information about this version\n");
(void)fprintf(stderr, "-H:\tthis message\n"); fprintf(stderr, "-H:\tthis message\n");
(void)fprintf(stderr, "Default is silent unpacking\n"); fprintf(stderr, "Default is silent unpacking\n");
exit(0); exit(0);
case 'V': case 'V':
(void)fprintf(stderr, "Version %s, ", VERSION); fprintf(stderr, "Version %s, ", VERSION);
(void)fprintf(stderr, "patchlevel %d", PATCHLEVEL); fprintf(stderr, "patchlevel %d", PATCHLEVEL);
(void)fprintf(stderr, "%s.\n", get_mina()); fprintf(stderr, "%s.\n", get_mina());
(void)fprintf(stderr, "Archive/file types recognized:\n"); fprintf(stderr, "Archive/file types recognized:\n");
#ifdef BIN #ifdef BIN
(void)fprintf(stderr, fprintf(stderr,
"\tBinHex 5.0, MacBinary 1.0 and UMCP (with caveat)\n"); "\tBinHex 5.0, MacBinary 1.0 and UMCP (with caveat)\n");
#endif /* BIN */ #endif /* BIN */
#ifdef JDW #ifdef JDW
(void)fprintf(stderr, "\tCompress It\n"); fprintf(stderr, "\tCompress It\n");
#endif /* JDW */ #endif /* JDW */
#ifdef STF #ifdef STF
(void)fprintf(stderr, "\tShrinkToFit\n"); fprintf(stderr, "\tShrinkToFit\n");
#endif /* STF */ #endif /* STF */
#ifdef LZC #ifdef LZC
(void)fprintf(stderr, "\tMacCompress\n"); fprintf(stderr, "\tMacCompress\n");
#endif /* LZC */ #endif /* LZC */
#ifdef ASQ #ifdef ASQ
(void)fprintf(stderr, "\tAutoSqueeze\n"); fprintf(stderr, "\tAutoSqueeze\n");
#endif /* ASQ */ #endif /* ASQ */
#ifdef ARC #ifdef ARC
(void)fprintf(stderr, "\tArcMac\n"); fprintf(stderr, "\tArcMac\n");
#endif /* ARC */ #endif /* ARC */
#ifdef PIT #ifdef PIT
(void)fprintf(stderr, "\tPackIt\n"); fprintf(stderr, "\tPackIt\n");
#endif /* PIT */ #endif /* PIT */
#ifdef SIT #ifdef SIT
(void)fprintf(stderr, "\tStuffIt and StuffIt Deluxe\n"); fprintf(stderr, "\tStuffIt and StuffIt Deluxe\n");
#endif /* SIT */ #endif /* SIT */
#ifdef DIA #ifdef DIA
(void)fprintf(stderr, "\tDiamond\n"); fprintf(stderr, "\tDiamond\n");
#endif /* DIA */ #endif /* DIA */
#ifdef CPT #ifdef CPT
(void)fprintf(stderr, "\tCompactor\n"); fprintf(stderr, "\tCompactor\n");
#endif /* CPT */ #endif /* CPT */
#ifdef ZMA #ifdef ZMA
(void)fprintf(stderr, "\tZoom\n"); fprintf(stderr, "\tZoom\n");
#endif /* ZMA */ #endif /* ZMA */
#ifdef LZH #ifdef LZH
(void)fprintf(stderr, "\tMacLHa\n"); fprintf(stderr, "\tMacLHa\n");
#endif /* LZH */ #endif /* LZH */
#ifdef DD #ifdef DD
(void)fprintf(stderr, "\tDiskDoubler and AutoDoubler\n"); fprintf(stderr, "\tDiskDoubler and AutoDoubler\n");
#endif /* DD */ #endif /* DD */
exit(0); exit(0);
} }
@ -137,7 +135,7 @@ char *argv[];
infp = stdin; infp = stdin;
} else { } else {
if((infp = fopen(argv[optind], "r")) == NULL) { if((infp = fopen(argv[optind], "r")) == NULL) {
(void)fprintf(stderr,"Can't open input file \"%s\"\n",argv[optind]); fprintf(stderr,"Can't open input file \"%s\"\n",argv[optind]);
exit(1); exit(1);
} }
#ifdef SCAN #ifdef SCAN
@ -157,7 +155,7 @@ char *argv[];
#ifdef STF #ifdef STF
case 'R': case 'R':
if(verbose) { if(verbose) {
(void)fprintf(stderr, "This is a \"ShrinkToFit\" packed file.\n"); fprintf(stderr, "This is a \"ShrinkToFit\" packed file.\n");
} }
stf(~(unsigned long)1); stf(~(unsigned long)1);
break; break;
@ -165,7 +163,7 @@ char *argv[];
#ifdef PIT #ifdef PIT
case 'P': case 'P':
if(verbose) { if(verbose) {
(void)fprintf(stderr, "This is a \"PackIt\" archive.\n"); fprintf(stderr, "This is a \"PackIt\" archive.\n");
} }
pit(); pit();
break; break;
@ -173,7 +171,7 @@ char *argv[];
#ifdef SIT #ifdef SIT
case 'S': case 'S':
if(verbose) { if(verbose) {
(void)fprintf(stderr, "This is a \"StuffIt\" archive.\n"); fprintf(stderr, "This is a \"StuffIt\" archive.\n");
} }
sit(); sit();
break; break;
@ -181,13 +179,13 @@ char *argv[];
#ifdef CPT #ifdef CPT
case 1: case 1:
if(verbose) { if(verbose) {
(void)fprintf(stderr, "This is a \"Compactor\" archive.\n"); fprintf(stderr, "This is a \"Compactor\" archive.\n");
} }
cpt(); cpt();
break; break;
#endif /* CPT */ #endif /* CPT */
default: default:
(void)fprintf(stderr, "Unrecognized archive type\n"); fprintf(stderr, "Unrecognized archive type\n");
exit(1); exit(1);
} }
exit(0); exit(0);
@ -196,7 +194,6 @@ char *argv[];
static void usage() static void usage()
{ {
(void)fprintf(stderr, "Usage: macunpack [-%s] [filename]\n", options); fprintf(stderr, "Usage: macunpack [-%s] [filename]\n", options);
(void)fprintf(stderr, "Use \"macunpack -H\" for help.\n"); fprintf(stderr, "Use \"macunpack -H\" for help.\n");
} }

View File

@ -133,19 +133,19 @@ void sit()
} }
} }
static int readsithdr(s) static int readsithdr(sitHdr *s)
struct sitHdr *s;
{ {
char temp[SITHDRSIZE]; char temp[SITHDRSIZE];
if(fread(temp, 1, SITHDRSIZE, infp) != SITHDRSIZE) { if (fread(temp, 1, SITHDRSIZE, infp) != SITHDRSIZE) {
return 0; return 0;
} }
if(strncmp(temp + S_SIGNATURE, "SIT!", 4) != 0 || if (strncmp(temp + S_SIGNATURE, "SIT!", 4) != 0
strncmp(temp + S_SIGNATURE2, "rLau", 4) != 0) { || strncmp(temp + S_SIGNATURE2, "rLau", 4) != 0)
(void)fprintf(stderr, "Not a StuffIt file\n"); {
return 0; fprintf(stderr, "Not a StuffIt file\n");
return 0;
} }
s->numFiles = get2(temp + S_NUMFILES); s->numFiles = get2(temp + S_NUMFILES);
@ -154,9 +154,7 @@ struct sitHdr *s;
return 1; return 1;
} }
static int sit_filehdr(f, skip) static int sit_filehdr(struct fileHdr *f, int skip)
struct fileHdr *f;
int skip;
{ {
register int i; register int i;
unsigned long crc; unsigned long crc;