This is Pinger.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "Pinger.h" #import "Subprocess.h" #import <nikit/NIOpenPanel.h> #import <appkit/TextField.h> #import <soundkit/Sound.h> #import <strings.h> id theSubprocess; id theSound; id thePanel; @implementation Pinger - init { pinging=NO; theSound=[Sound findSoundFor:"Sonar"]; thePanel=[NIDomainPanel new]; return self; } - beginPing:sender { char buf[120],host[110]; if (pinging) [self stopPing:self]; [hostForm selectText:self]; sprintf(buf,"%s//ping ",[pingPath stringValue]); strcpy(host,[hostForm stringValue]); if (host[0]=='/') host[0]=' '; strcat(buf,host); theSubprocess=[[Subprocess alloc] init:buf withDelegate:self andPtySupport:NO andStdErr:YES]; pinging=YES; return self; } - chooseHost:sender { id thePanel = [NIOpenPanel new]; [thePanel setListTitle: "Machine Names"]; [thePanel setPanelTitle: "Machine Name Picker" ]; if ([thePanel runModal] == NX_OKTAG) { const char *fullDomain = [thePanel directory]; if (fullDomain && *fullDomain){ [hostForm setStringValue: (char *)fullDomain]; //[self changeHostName:self]; //optional, add this method if you want to trigger the change. } } return self; } - stopPing:sender { if (!pinging) return self; [theSubprocess terminate:sender]; return self; } - subprocessOutput:(char *)buffer { if (index(buffer,'_')!=0) [theSound play]; return self; } - subprocessDone { pinging=NO; return self; } - subprocessError:(const char *)errorString { [self stopPing:self]; 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.