This is Kdestroy.m in view mode; [Download] [Up]
/* Kerberos Ticket Destroyer */
#import <appkit/Panel.h>
#import <appkit/TextField.h>
#import "Subprocess.h"
#import "Reporter.h"
#import "Kdestroy.h"
int strlen(char *s);
char *strcpy(char *s1, char *s2);
int strcmp(char *s1, char *s2);
char *malloc(unsigned u);
char *realloc(char *b, unsigned u);
void free(char *b);
int system(char *cmd);
/* ====================================================================== */
@implementation Kdestroy
/* ---------------------------------------------------------------------- */
/* Destroy user's Kerberos tickets, by running a kdestroy process. */
- destroyTickets:sender
{
outputBuffer= NULL;
if (!kdestroyProcess) {
kdestroyProcess= [Subprocess new];
}
[kdestroyProcess init:"/usr/local/bin/kdestroy" withDelegate:self
andPtySupport:NO andStdErr:YES];
return self;
}
/* ====================================================================== */
/* Subprocess Delegation */
/* ---------------------------------------------------------------------- */
/* Buffer output from kdestroy. */
-subprocessOutput:(char *)buffer
{
if (outputBuffer) {
outputBuffer=
realloc(outputBuffer,strlen(outputBuffer)+strlen(buffer)+2);
} else {
outputBuffer= malloc(strlen(buffer)+1);
outputBuffer[0]= '\0';
}
strcpy(outputBuffer+strlen(outputBuffer), buffer);
return self;
}
/* ---------------------------------------------------------------------- */
/* Check that kdestroy did what we expected. Put up a panel if not. */
- subprocessDone
{
if (outputBuffer && strcmp(outputBuffer,"Tickets destroyed.\n"))
NXRunAlertPanel(0, outputBuffer ? outputBuffer :
"Problem destroying tickets.", 0, 0, 0);
if (outputBuffer) free(outputBuffer);
outputBuffer= NULL;
[klistReporter refresh:self];
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.