langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
|
|
@ -0,0 +1,43 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "ActionObjectProtocol.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSArray *args;
|
||||
id <ActionObjectProtocol> action;
|
||||
NSString *msg, *backmsg;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
action = (id <ActionObjectProtocol>)
|
||||
[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: @"DistributedAction"
|
||||
host: @"localhost"
|
||||
usingNameServer: [NSSocketPortNameServer sharedInstance] ];
|
||||
|
||||
if (action == nil)
|
||||
{
|
||||
NSLog(@"can't connect to the server");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
args = [[NSProcessInfo processInfo] arguments];
|
||||
|
||||
if ([args count] == 1)
|
||||
{
|
||||
NSLog(@"specify a message");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
msg = [args objectAtIndex: 1];
|
||||
|
||||
// "send" (call the selector "sendMessage:" of the (remote) object
|
||||
// action) the first argument's text as msg, store the message "sent
|
||||
// back" and then show it in the log
|
||||
backmsg = [action sendMessage: msg];
|
||||
NSLog("%@", backmsg);
|
||||
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue