2 * Copyright 2010, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
9 #include <Application.h>
11 #include <NodeMonitor.h>
14 class Application
: public BApplication
{
17 virtual ~Application();
20 virtual void ArgvReceived(int32 argCount
, char** args
);
21 virtual void ReadyToRun();
22 virtual void MessageReceived(BMessage
* message
);
29 Application::Application()
31 BApplication("application/x-vnd.test-node-monitor-test"),
37 Application::~Application()
43 Application::ArgvReceived(int32 argCount
, char** args
)
45 uint32 flags
= B_WATCH_STAT
;
47 for (int32 i
= 0; i
< argCount
; i
++) {
48 BEntry
entry(args
[i
]);
49 if (!entry
.Exists()) {
50 fprintf(stderr
, "Entry does not exist: %s\n", args
[i
]);
55 entry
.GetNodeRef(&nodeRef
);
56 if (watch_node(&nodeRef
, flags
, this) == B_OK
)
63 Application::ReadyToRun()
71 Application::MessageReceived(BMessage
* message
)
73 switch (message
->what
) {
75 message
->PrintToStream();
79 BApplication::MessageReceived(message
);
88 main(int argc
, char** argv
)