#import <appkit/appkit.h>
#import "PBNames.h"

int main (int argc, char * argv [])
{
	if (argc > 1)
	{	char * fnm = argv[1];
		NXAtom pbKey = argc <= 2 ? NXGeneralPboard :
			argv[2][0] == '-' ? [[PBNames new] key:argv[2]+1] :
			NXUniqueString(argv[2]);
		id pb = [Pasteboard newName:pbKey];

		if (fnm[0] != '/')
			getwd(fnm = alloca(MAXPATHLEN)),
			strcat(fnm, "/"), strcat(fnm, argv[1]);
		[pb types];		// sollte aufgerufen werden...
		fnm = [pb readFileContentsType:NULL toFile:fnm];
		if (fnm && access(fnm, 0) == 0)
			puts(fnm);
		else
			[pb error:"no file\n"];
		free(fnm);
	}
	return 0;
}
