
/* Generated by Interface Builder */

#import <stdio.h>
#include <string.h>
#import "UntarApp.h"

@implementation UntarApp

- (BOOL)appAcceptsAnotherFile:sender
{
	return YES;
}

char *Split(char *name)
{
	static char  	Buffer[1000];
	int				x;

	strcpy(Buffer, name);
	for (x = strlen(Buffer); x; x--) {
		if (Buffer[x] == '/') {
			Buffer[x] = '\0';
			break;
		}
	}
	return (Buffer); 
}

void system(char *);
void chdir(char *);

- (int)app:sender openFile:(const char *)filename type:(const char *)aType
{
	FILE	*console;
	char		Buffer[1000];
	
	console = fopen ("/dev/console", "w");
	fprintf(console, "Should open %s of type %s\n", filename, aType);
	fflush(console);
	sprintf(Buffer, "tar -xvf %s", filename);
	chdir(Split((char *)filename));
	system(Buffer);
	
	return YES;
}

@end
