This is Coordinator.m in view mode; [Download] [Up]
/* Coordinator.m by Joe Freeman, David LaVallee Subprocess Example, Release 2.0 NeXT Computer, Inc. You may freely copy, distribute and reuse the code in this example. NeXT disclaims any warranty of any kind, expressed or implied, as to its fitness for any particular use. */ #import "Coordinator.h" #import "CommandScroll.h" #import "Subprocess.h" #import <appkit/nextstd.h> #import <appkit/Application.h> #import <appkit/Panel.h> #import <objc/NXStringTable.h> @implementation Coordinator - showInfo:sender { if (!infoPanel) { infoPanel = [NXApp loadNibSection:"InfoPanel.nib" owner:NXApp withNames:NO]; } [infoPanel orderFront:self]; return self; } /*========================================================== * * Subprocess Delegation * *==========================================================*/ - subprocessOutput:(char *)buffer { [commandView appendString:buffer]; return self; } - subprocessDone { [NXApp terminate:self]; return self; } - subprocessError:(const char *)errorString // uses stringTable to localize error messages as appropriate, // and then displays the message in an alert panel { const char *returnedString; if (returnedString = [stringTable valueForStringKey:errorString]) { NXRunAlertPanel(0, returnedString, 0, 0, 0); } else { NXRunAlertPanel(0, errorString, 0, 0, 0); } return self; } /*========================================================== * * CommandScroll Delegation * *==========================================================*/ - userEntered:(char *)buffer { [theSubprocess send:buffer withNewline:NO]; return self; } /*========================================================== * * Application Object Delegation * *==========================================================*/ - appDidInit:sender { theSubprocess = [[Subprocess alloc] init:"/bin/sh" withDelegate:self andPtySupport:YES andStdErr:YES]; return self; } - appWillTerminate:sender { [theSubprocess terminate:sender]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.