ftp.nice.ch/pub/next/developer/objc/appkit/RemoteCommand.1.s.tar.gz#/RemoteCommand1/execServer.subproj/RemoteRunServer.m

This is RemoteRunServer.m in view mode; [Download] [Up]

// -------------------------------------------------------------------------------------
// RemoteRunServer
// This server performs tasks (executes commands) sent to it by the main app.
// -------------------------------------------------------------------------------------
// Permission is granted to freely redistribute this source code, and to use fragments
// of this code in your own applications if you find them to be useful.  This class,
// along with the source code, come with no warranty of any kind, and the user assumes
// all responsibility for its use.
// -------------------------------------------------------------------------------------

#import <appkit/appkit.h>
#import <libc.h>
#import <stdlib.h>
#import <string.h>
#import <pwd.h>
#import <sys/param.h>
#import <sys/types.h>
#import <sys/time.h>
#import <sys/dir.h>
#import "ExecServer.h"

/* main entry point */
void main(int argc, char *argv[])
{
	int		a;
	id		rs;
	
	/* check number fo args */
	if (argc < 2) {
		fprintf(stderr,
			"usage: ExecServer [-e] "
			"[-r <remoteServer>] "
			"[-m <mainAppServer> [<mainAppHost>]] "
			"[-c <commandPath>] "
			"\n");
		exit(1);
	}
	
	/* ExecServer init */
	rs = [[ExecServer alloc] init];
//	[rs setMethodDelegate:[<OtherMethods> class]];
//	[rs setLoggingDelegate:[<Logging> class]];

	/* command arguments */
	for (a = 1; (a < argc) && (*argv[a] == '-'); a++) {
		switch (argv[a][1]) {
			case 'e':	// 'exitWhenDone' flag
				[rs setExitWhenDone:YES];
				break;
			case 'r':	// remote server name
				if ((a + 1) < argc) [rs setRemoteServerName:argv[++a]];
				break;
			case 'm':	// main app server
				if ((a + 1) < argc) {
					char *mainAppServer = argv[++a], *mainAppHost = (char*)nil;
					if (((a + 1) < argc) && (*argv[a + 1] != '-')) mainAppHost = argv[++a];
					[rs setMainAppServerName:mainAppServer host:mainAppHost];
				}
				break;
			case 'c':
				if ((a + 1) < argc) [rs setMainAppPath:argv[++a]];
				break;
			default:
				break;
		}
	}
	
	/* start remote object server (does not return) */
	[rs _runServer];
	exit(0);
	
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.