Small test app for testing the shutdown process. I didn't search long if
something like this already exists... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34263 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
SubDir HAIKU_TOP src tests apps ;
|
SubDir HAIKU_TOP src tests apps ;
|
||||||
|
|
||||||
|
SubInclude HAIKU_TOP src tests apps delay_shutdown ;
|
||||||
SubInclude HAIKU_TOP src tests apps fake_app_server ;
|
SubInclude HAIKU_TOP src tests apps fake_app_server ;
|
||||||
SubInclude HAIKU_TOP src tests apps installer ;
|
SubInclude HAIKU_TOP src tests apps installer ;
|
||||||
SubInclude HAIKU_TOP src tests apps miniterminal ;
|
SubInclude HAIKU_TOP src tests apps miniterminal ;
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Stephan Aßmus <[email protected]>
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
|
||||||
|
|
||||||
|
class DelayShutdownApp : public BApplication {
|
||||||
|
public:
|
||||||
|
DelayShutdownApp()
|
||||||
|
:
|
||||||
|
BApplication("application/x-vnd.Haiku-DelayShutdown"),
|
||||||
|
fDelay(5LL),
|
||||||
|
fQuit(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void ArgvReceived(int32 argc, char* argv[])
|
||||||
|
{
|
||||||
|
if (argc <= 1) {
|
||||||
|
_PrintUsageAndQuit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 index = 1;
|
||||||
|
|
||||||
|
while (index < argc) {
|
||||||
|
if (strcmp(argv[index], "-d") == 0) {
|
||||||
|
if (index + 1 < argc)
|
||||||
|
fDelay = atoi(argv[++index]);
|
||||||
|
else {
|
||||||
|
_PrintUsageAndQuit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (strcmp(argv[index], "-q") == 0) {
|
||||||
|
fQuit = true;
|
||||||
|
} else {
|
||||||
|
_PrintUsageAndQuit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool QuitRequested()
|
||||||
|
{
|
||||||
|
snooze(fDelay * 1000000);
|
||||||
|
return fQuit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _PrintUsageAndQuit()
|
||||||
|
{
|
||||||
|
printf("usage:\n"
|
||||||
|
"\t-d <x> - wait x seconds before replying the quit\n"
|
||||||
|
"\t request.\n"
|
||||||
|
"\t-q - respond positively to the quit request\n"
|
||||||
|
"\t (default: don't quit).\n");
|
||||||
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
bigtime_t fDelay;
|
||||||
|
bool fQuit;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
DelayShutdownApp app;
|
||||||
|
app.Run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
resource app_signature "application/x-vnd.Haiku-DelayShutdown";
|
||||||
|
|
||||||
|
resource app_flags B_SINGLE_LAUNCH;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
SubDir HAIKU_TOP src tests apps delay_shutdown ;
|
||||||
|
|
||||||
|
Application DelayShutdown :
|
||||||
|
DelayShutdown.cpp
|
||||||
|
: be
|
||||||
|
;
|
||||||
Reference in New Issue
Block a user