From 30dbdd96f94ba5b1d2e86363e0db3c376694d153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 3 Dec 2002 19:33:52 +0000 Subject: [PATCH] Added quit, code by Carlos Hasan. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2155 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/Jamfile | 1 + src/apps/bin/quit.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/apps/bin/quit.cpp diff --git a/src/apps/bin/Jamfile b/src/apps/bin/Jamfile index 74127a62a8..bba7a77f4b 100644 --- a/src/apps/bin/Jamfile +++ b/src/apps/bin/Jamfile @@ -10,6 +10,7 @@ StdBinCommands isvolume.cpp listattr.cpp lsindex.cpp + quit.cpp setversion.cpp shutdown.cpp version.cpp diff --git a/src/apps/bin/quit.cpp b/src/apps/bin/quit.cpp new file mode 100644 index 0000000000..b3541ec2d3 --- /dev/null +++ b/src/apps/bin/quit.cpp @@ -0,0 +1,33 @@ +/* + * quit.cpp + * (c) 2002, Carlos Hasan, for OpenBeOS. + */ + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + status_t status; + + if (argc != 2) { + printf("use: %s mime_sig\n", argv[0]); + return 1; + } + + BMessenger messenger(argv[1]); + + if (!messenger.IsValid()) { + printf("could not find running app with sig %s\n", argv[1]); + return 1; + } + + if ((status = messenger.SendMessage(B_QUIT_REQUESTED)) != B_OK) { + printf("could not send message, %s\n", strerror(status)); + return 1; + } + + return 0; +} +