Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1889,10 +1889,11 @@ AC_DEFINE(HAVE_TLS_SUPPORT, 1, [Whether we have an implementation for TLS]) AC_CONFIG_FILES(src/tls/Info.plist) OFARC_LIBS="-lobjfwtls $TLS_LIBS $OFARC_LIBS" + OFHASH_LIBS="-lobjfwtls $TLS_LIBS $OFHASH_LIBS" OFHTTP_LIBS="-lobjfwtls $TLS_LIBS $OFHTTP_LIBS" AS_IF([test x"$enable_shared" != x"no"], [ AC_SUBST(OBJFWTLS_SHARED_LIB, '${LIB_PREFIX}objfwtls${LIB_SUFFIX}') Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -50,10 +50,11 @@ OBJFW_NEW = @OBJFW_NEW@ OFARC = @OFARC@ OFARC_LIBS = @OFARC_LIBS@ OFDNS = @OFDNS@ OFHASH = @OFHASH@ +OFHASH_LIBS = @OFHTTP_LIBS@ OFHTTP = @OFHTTP@ OFHTTP_LIBS = @OFHTTP_LIBS@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ OF_GNUTLS_TLS_STREAM_M = @OF_GNUTLS_TLS_STREAM_M@ Index: utils/ofhash/Makefile ================================================================== --- utils/ofhash/Makefile +++ utils/ofhash/Makefile @@ -14,8 +14,10 @@ CPPFLAGS += -I../../src \ -I../../src/runtime \ -I../../src/exceptions \ -I../.. \ -DLOCALIZATION_DIR=\"${datadir}/ofhash/localization\" -LIBS := -L../../src -lobjfw -L../../src/runtime ${RUNTIME_LIBS} ${LIBS} +LIBS := -L../../src -L../../src/tls ${OFHASH_LIBS} -lobjfw \ + -L../../src/runtime ${RUNTIME_LIBS} \ + ${LIBS} LD = ${OBJC} LDFLAGS += ${LDFLAGS_RPATH} Index: utils/ofhash/OFHash.m ================================================================== --- utils/ofhash/OFHash.m +++ utils/ofhash/OFHash.m @@ -17,10 +17,11 @@ #import "OFApplication.h" #import "OFArray.h" #import "OFFile.h" #import "OFIRI.h" +#import "OFIRIHandler.h" #import "OFLocale.h" #import "OFMD5Hash.h" #import "OFOptionsParser.h" #import "OFRIPEMD160Hash.h" #import "OFSHA1Hash.h" @@ -43,11 +44,11 @@ static void help(void) { [OFStdErr writeLine: OF_LOCALIZED(@"usage", @"Usage: %[prog] [--md5] [--ripemd160] [--sha1] [--sha224] " - @"[--sha256] [--sha384] [--sha512] file1 [file2 ...]", + @"[--sha256] [--sha384] [--sha512] [--iri] file1 [file2 ...]", @"prog", [OFApplication programName])]; [OFApplication terminateWithStatus: 1]; } @@ -71,19 +72,20 @@ @implementation OFHash - (void)applicationDidFinishLaunching: (OFNotification *)notification { int exitStatus = 0; bool calculateMD5, calculateRIPEMD160, calculateSHA1, calculateSHA224; - bool calculateSHA256, calculateSHA384, calculateSHA512; + bool calculateSHA256, calculateSHA384, calculateSHA512, isIRI; const OFOptionsParserOption options[] = { { '\0', @"md5", 0, &calculateMD5, NULL }, { '\0', @"ripemd160", 0, &calculateRIPEMD160, NULL }, { '\0', @"sha1", 0, &calculateSHA1, NULL }, { '\0', @"sha224", 0, &calculateSHA224, NULL }, { '\0', @"sha256", 0, &calculateSHA256, NULL }, { '\0', @"sha384", 0, &calculateSHA384, NULL }, { '\0', @"sha512", 0, &calculateSHA512, NULL }, + { '\0', @"iri", 0, &isIRI, NULL }, { '\0', nil, 0, NULL, NULL } }; OFOptionsParser *optionsParser = [OFOptionsParser parserWithOptions: options]; OFUnichar option; @@ -132,12 +134,13 @@ @try { sandbox.allowsStdIO = true; sandbox.allowsReadingFiles = true; sandbox.allowsUserDatabaseReading = true; - for (OFString *path in optionsParser.remainingArguments) - [sandbox unveilPath: path permissions: @"r"]; + if (!isIRI) + for (OFString *path in optionsParser.remainingArguments) + [sandbox unveilPath: path permissions: @"r"]; [sandbox unveilPath: @LOCALIZATION_DIR permissions: @"r"]; [OFApplication of_activateSandbox: sandbox]; } @finally { @@ -171,24 +174,35 @@ for (OFString *path in optionsParser.remainingArguments) { void *pool = objc_autoreleasePoolPush(); OFStream *file; - if ([path isEqual: @"-"]) + if (!isIRI && [path isEqual: @"-"]) file = OFStdIn; else { @try { - file = [OFFile fileWithPath: path mode: @"r"]; + if (isIRI) { + OFIRI *IRI = + [OFIRI IRIWithString: path]; + + file = [OFIRIHandler + openItemAtIRI: IRI + mode: @"r"]; + } else + file = [OFFile fileWithPath: path + mode: @"r"]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; + OFString *filePath = + (e.IRI != nil ? e.IRI.string : e.path); [OFStdErr writeLine: OF_LOCALIZED( @"failed_to_open_file", @"Failed to open file %[file]: %[error]", - @"file", e.path, + @"file", filePath, @"error", error)]; exitStatus = 1; goto outer_loop_end; } Index: utils/ofhash/localization/de.json ================================================================== --- utils/ofhash/localization/de.json +++ utils/ofhash/localization/de.json @@ -10,12 +10,12 @@ /* vim: se ft=javascript sw=4 et: */ { usage: [ "Benutzung: %[prog] [--md5] [--ripemd160] [--sha1] [--sha224] ", - "[--sha256] [--sha384] [--sha512] datei1 [datei2 ...]" + "[--sha256] [--sha384] [--sha512] [--iri] datei1 [datei2 ...]" ], unknown_long_option: "%[prog]: Unbekannte Option: --%[opt]", unknown_option: "%[prog]: Unbekannte Option: -%[opt]", failed_to_open_file: "Fehler beim Öffnen der Datei %[file]: %[error]", failed_to_read_file: "Fehler beim Lesen der Datei %[file]: %[error]", }