xref: /haiku/src/bin/quit.cpp (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
1 /*
2  * quit.cpp
3  * (c) 2002, Carlos Hasan, for Haiku.
4  */
5 
6 #include <stdio.h>
7 #include <string.h>
8 #include <app/Messenger.h>
9 
10 int main(int argc, char *argv[])
11 {
12 	status_t status;
13 
14 	if (argc != 2) {
15 		printf("use: %s mime_sig\n", argv[0]);
16 		return 1;
17 	}
18 
19 	BMessenger messenger(argv[1]);
20 
21 	if (!messenger.IsValid()) {
22 		printf("could not find running app with sig %s\n", argv[1]);
23 		return 1;
24 	}
25 
26 	if ((status = messenger.SendMessage(B_QUIT_REQUESTED)) != B_OK) {
27 		printf("could not send message, %s\n", strerror(status));
28 		return 1;
29 	}
30 
31 	return 0;
32 }
33 
34