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

int main (int argc, char * argv [])
{	NXStream * sp = NXOpenFile(0, NX_READONLY);
	NXAtom type = argc <= 1 ? NXAsciiPboardType :
		argv[1][0] == '-' ? [[PBTypes new] type:argv[1]+1] :
		NXUniqueString(argv[1]);
	NXAtom pbKey = argc <= 2 ? NXGeneralPboard :
		argv[2][0] == '-' ? [[PBNames new] key:argv[2]+1] :
		NXUniqueString(argv[2]);
	id pb = [Pasteboard newName:pbKey];
    
	[pb declareTypes:&type num:1 owner:nil];
	if (! [pb writeType:type fromStream:sp])
		[pb error:"not owner\n"];
	return 0;
}
