38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFOpenItemFailedException.h"
#import "OFReadFailedException.h"
#import "OFSeekFailedException.h"
#import "OFWriteFailedException.h"
#define BUFFER_SIZE 4096
OF_APPLICATION_DELEGATE(OFArc)
static void
help(OFStream *stream, bool full, int status)
{
[stream writeLine: OF_LOCALIZED(@"usage",
|
|
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFOpenItemFailedException.h"
#import "OFReadFailedException.h"
#import "OFSeekFailedException.h"
#import "OFWriteFailedException.h"
#define bufferSize 4096
OF_APPLICATION_DELEGATE(OFArc)
static void
help(OFStream *stream, bool full, int status)
{
[stream writeLine: OF_LOCALIZED(@"usage",
|
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
return true;
}
- (ssize_t)copyBlockFromStream: (OFStream *)input
toStream: (OFStream *)output
fileName: (OFString *)fileName
{
char buffer[BUFFER_SIZE];
size_t length;
@try {
length = [input readIntoBuffer: buffer length: BUFFER_SIZE];
} @catch (OFReadFailedException *e) {
OFString *error = [OFString
stringWithCString: strerror(e.errNo)
encoding: [OFLocale encoding]];
[OFStdOut writeString: @"\r"];
[OFStdErr writeLine: OF_LOCALIZED(@"failed_to_read_file",
@"Failed to read file %[file]: %[error]",
|
|
|
|
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
return true;
}
- (ssize_t)copyBlockFromStream: (OFStream *)input
toStream: (OFStream *)output
fileName: (OFString *)fileName
{
char buffer[bufferSize];
size_t length;
@try {
length = [input readIntoBuffer: buffer length: bufferSize];
} @catch (OFReadFailedException *e) {
OFString *error = [OFString
stringWithCString: strerror(e.errNo)
encoding: [OFLocale encoding]];
[OFStdOut writeString: @"\r"];
[OFStdErr writeLine: OF_LOCALIZED(@"failed_to_read_file",
@"Failed to read file %[file]: %[error]",
|