mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 08:31:55 +00:00
Tweaks and debugging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17063 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7a468350a5
commit
a5399b06c6
5 changed files with 71 additions and 22 deletions
|
@ -1,4 +1,15 @@
|
|||
NSServices = (
|
||||
{
|
||||
NSFilter = cat;
|
||||
NSInputMechanism = NSUnixStdio;
|
||||
NSPortName = "/bin/cat";
|
||||
NSSendTypes = (
|
||||
NSFilenamesPboardType
|
||||
);
|
||||
NSReturnTypes = (
|
||||
NSGeneralPboardType
|
||||
);
|
||||
},
|
||||
{
|
||||
NSPortName = ExampleServices;
|
||||
NSFilter = md5;
|
||||
|
|
|
@ -25,33 +25,50 @@
|
|||
#include <Foundation/NSFileHandle.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <AppKit/NSPasteboard.h>
|
||||
|
||||
int
|
||||
main(int argc, char** argv, char **env_c)
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
NSFileHandle *fh;
|
||||
NSData *data;
|
||||
NSString *string;
|
||||
NSPasteboard *pb;
|
||||
NSFileHandle *fh;
|
||||
NSData *data;
|
||||
NSString *string;
|
||||
NSPasteboard *pb;
|
||||
NSUserDefaults *defs;
|
||||
|
||||
#ifdef GS_PASS_ARGUMENTS
|
||||
[NSProcessInfo initializeWithArguments:argv count:argc environment:env_c];
|
||||
#endif
|
||||
|
||||
NSLog(@"This program expects to read utf8 text from stdin -");
|
||||
fh = [NSFileHandle fileHandleWithStandardInput];
|
||||
data = [fh readDataToEndOfFile];
|
||||
string = [[NSString alloc] initWithData: data
|
||||
encoding: NSUTF8StringEncoding];
|
||||
data = [NSSerializer serializePropertyList: string];
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
string = [defs stringForKey: @"CatFile"];
|
||||
if (string != nil)
|
||||
{
|
||||
data = [NSSerializer serializePropertyList: string];
|
||||
pb = [NSPasteboard pasteboardByFilteringData: data
|
||||
ofType: NSFilenamesPboardType];
|
||||
NSLog(@"Types: %@", [pb types]);
|
||||
data = [pb dataForType: NSGeneralPboardType];
|
||||
NSLog(@"Got %@", data);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"This program expects to read utf8 text from stdin -");
|
||||
fh = [NSFileHandle fileHandleWithStandardInput];
|
||||
data = [fh readDataToEndOfFile];
|
||||
string = [[NSString alloc] initWithData: data
|
||||
encoding: NSUTF8StringEncoding];
|
||||
data = [NSSerializer serializePropertyList: string];
|
||||
|
||||
pb = [NSPasteboard pasteboardByFilteringData: data
|
||||
ofType: NSStringPboardType];
|
||||
NSLog(@"Types: %@", [pb types]);
|
||||
data = [pb dataForType: @"md5Digest"];
|
||||
NSLog(@"Got %@", data);
|
||||
}
|
||||
|
||||
pb = [NSPasteboard pasteboardByFilteringData: data
|
||||
ofType: NSStringPboardType];
|
||||
NSLog(@"Types: %@", [pb types]);
|
||||
data = [pb dataForType: @"md5Digest"];
|
||||
NSLog(@"Got %@", data);
|
||||
RELEASE(pool);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue