btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / bin / draggers.cpp
blob8e86cea58f693e8131e9ead7012e489830f00d52
1 /*
2 * Copyright 2016, François Revol, <revol@free.fr>. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
6 /*
7 * draggers - show/hide draggers from CLI
8 */
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <Application.h>
14 #include <Dragger.h>
17 int usage(int ret)
19 fprintf(stderr, "draggers [show|hide]\n");
20 fprintf(stderr, "Shows/sets draggers state\n");
21 return ret;
25 int main(int argc, char **argv)
27 int i;
28 BApplication app("application/x-vnd.Haiku-draggers");
29 if (argc < 2) {
30 printf("%s\n", BDragger::AreDraggersDrawn()?"shown":"hidden");
31 return EXIT_SUCCESS;
33 for (i = 1; i < argc; i++) {
34 if (!strncmp(argv[i], "-h", 2)) {
35 return usage(EXIT_SUCCESS);
37 if (!strcmp(argv[i], "1")
38 || !strncmp(argv[i], "en", 2)
39 || !strncmp(argv[i], "sh", 2)
40 || !strncmp(argv[i], "on", 2))
41 BDragger::ShowAllDraggers();
42 else if (!strcmp(argv[i], "0")
43 || !strncmp(argv[i], "di", 2)
44 || !strncmp(argv[i], "hi", 2)
45 || !strncmp(argv[i], "of", 2))
46 BDragger::HideAllDraggers();
47 else
48 return usage(EXIT_FAILURE);
50 return EXIT_SUCCESS;