ObjFW  Diff

Differences From Artifact [ea3185f976]:

To Artifact [fe40a35a63]:


27
28
29
30
31
32
33

34
35
36
37
38
39
40
#import "OFOptionsParser.h"
#import "OFSandbox.h"
#import "OFStdIOStream.h"
#import "OFURL.h"

#import "OFZIP.h"
#import "GZIPArchive.h"

#import "TarArchive.h"
#import "ZIPArchive.h"

#import "OFCreateDirectoryFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "OFOptionsParser.h"
#import "OFSandbox.h"
#import "OFStdIOStream.h"
#import "OFURL.h"

#import "OFZIP.h"
#import "GZIPArchive.h"
#import "LHAArchive.h"
#import "TarArchive.h"
#import "ZIPArchive.h"

#import "OFCreateDirectoryFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
		    @"    -h  --help        Show this help\n"
		    @"    -l  --list        List all files in the archive\n"
		    @"    -n  --no-clobber  Never overwrite files\n"
		    @"    -p  --print       Print one or more files from the "
		    @"archive\n"
		    @"    -q  --quiet       Quiet mode (no output, except "
		    @"errors)\n"
		    @"    -t  --type        Archive type (gz, tar, tgz, zip)\n"

		    @"    -v  --verbose     Verbose output for file list\n"
		    @"    -x  --extract     Extract files")];
	}

	[OFApplication terminateWithStatus: status];
}








|
>







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
		    @"    -h  --help        Show this help\n"
		    @"    -l  --list        List all files in the archive\n"
		    @"    -n  --no-clobber  Never overwrite files\n"
		    @"    -p  --print       Print one or more files from the "
		    @"archive\n"
		    @"    -q  --quiet       Quiet mode (no output, except "
		    @"errors)\n"
		    @"    -t  --type        Archive type (gz, lha, tar, tgz, "
		    @"zip)\n"
		    @"    -v  --verbose     Verbose output for file list\n"
		    @"    -x  --extract     Extract files")];
	}

	[OFApplication terminateWithStatus: status];
}

438
439
440
441
442
443
444


445
446
447
448
449
450
451
452
453
454
455




456
457
458
459
460
461
462
	if (type == nil || [type isEqual: @"auto"]) {
		/* This one has to be first for obvious reasons */
		if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] ||
		    [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"])
			type = @"tgz";
		else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"])
			type = @"gz";


		else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"])
			type = @"tar";
		else
			type = @"zip";
	}

	@try {
		if ([type isEqual: @"gz"])
			archive = [GZIPArchive archiveWithStream: file
							    mode: modeString
							encoding: encoding];




		else if ([type isEqual: @"tar"])
			archive = [TarArchive archiveWithStream: file
							   mode: modeString
						       encoding: encoding];
		else if ([type isEqual: @"tgz"]) {
			OFStream *GZIPStream = [OFGZIPStream
			    streamWithStream: file







>
>











>
>
>
>







440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
	if (type == nil || [type isEqual: @"auto"]) {
		/* This one has to be first for obvious reasons */
		if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] ||
		    [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"])
			type = @"tgz";
		else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"])
			type = @"gz";
		else if ([path hasSuffix: @".lha"] || [path hasSuffix: @".lzh"])
			type = @"lha";
		else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"])
			type = @"tar";
		else
			type = @"zip";
	}

	@try {
		if ([type isEqual: @"gz"])
			archive = [GZIPArchive archiveWithStream: file
							    mode: modeString
							encoding: encoding];
		else if ([type isEqual: @"lha"])
			archive = [LHAArchive archiveWithStream: file
							   mode: modeString
						       encoding: encoding];
		else if ([type isEqual: @"tar"])
			archive = [TarArchive archiveWithStream: file
							   mode: modeString
						       encoding: encoding];
		else if ([type isEqual: @"tgz"]) {
			OFStream *GZIPStream = [OFGZIPStream
			    streamWithStream: file