@@ -23,15 +23,15 @@ #import "OFStream.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFURL.h" -#define BUFFER_LEN 4096 +#define bufferLen 4096 @interface OFSock: OFObject { - char _buffer[BUFFER_LEN]; + char _buffer[bufferLen]; OFMutableArray OF_GENERIC(OFPair OF_GENERIC(OFStream *, OFStream *) *) *_streams; int _errors; } @end @@ -43,29 +43,29 @@ { OFURL *URL; OFString *scheme; if ([string isEqual: @"-"]) - return [OFPair pairWithFirstObject: of_stdin - secondObject: of_stdout]; + return [OFPair pairWithFirstObject: OFStdIn + secondObject: OFStdOut]; URL = [OFURL URLWithString: string]; scheme = URL.scheme; if ([scheme isEqual: @"tcp"]) { OFTCPSocket *sock = [OFTCPSocket socket]; if (URL.port == nil) { - [of_stderr writeLine: @"Need a port!"]; + [OFStdErr writeLine: @"Need a port!"]; [OFApplication terminateWithStatus: 1]; } [sock connectToHost: URL.host port: URL.port.shortValue]; return [OFPair pairWithFirstObject: sock secondObject: sock]; } - [of_stderr writeFormat: @"Invalid protocol: %@\n", scheme]; + [OFStdErr writeFormat: @"Invalid protocol: %@\n", scheme]; [OFApplication terminateWithStatus: 1]; abort(); } @implementation OFSock @@ -72,11 +72,11 @@ - (void)applicationDidFinishLaunching { OFArray OF_GENERIC(OFString *) *arguments = [OFApplication arguments]; if (arguments.count < 1) { - [of_stderr writeLine: @"Need at least one argument!"]; + [OFStdErr writeLine: @"Need at least one argument!"]; [OFApplication terminateWithStatus: 1]; } _streams = [[OFMutableArray alloc] init]; @@ -87,20 +87,19 @@ [_streams addObject: pair]; } if (arguments.count == 1) { - of_stdin.delegate = self; + OFStdIn.delegate = self; - [_streams addObject: - [OFPair pairWithFirstObject: of_stdin - secondObject: of_stdout]]; + [_streams addObject: [OFPair pairWithFirstObject: OFStdIn + secondObject: OFStdOut]]; } for (OFPair *pair in _streams) [pair.firstObject asyncReadIntoBuffer: _buffer - length: BUFFER_LEN]; + length: bufferLen]; } - (void)removeDeadStream: (OFStream *)stream { size_t count = _streams.count; @@ -120,12 +119,12 @@ didReadIntoBuffer: (void *)buffer length: (size_t)length exception: (id)exception { if (exception != nil) { - [of_stderr writeFormat: @"Exception on stream %@: %@\n", - stream, exception]; + [OFStdErr writeFormat: @"Exception on stream %@: %@\n", + stream, exception]; _errors++; [self removeDeadStream: stream]; return false; }