- changing MaxInstructions to 100 for cthulhain (crazy nut) =:)
[bbkeys.git] / src / main.cc
blobbfcf72631c15ae176e18835b2e9a82d95ae724c0
1 // Basewindow.cc for bbtools.
2 //
3 // Copyright (c) 1998-1999 by John Kennis, jkennis@chello.nl
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 // (See the included file COPYING / GPL-2.0)
21 // $Id$
23 #include "bbkeys.hh"
24 #include "main.hh"
26 void Usage()
28 fprintf(stderr, "\n%s version %s \n", BBTOOL, BBTOOL_VERSION);
29 fprintf(stderr, "Usage: %s [options]\n", BBTOOL);
30 fprintf(stderr, "Options:\n"
31 " -display <display name> X server to connect to\n"
32 " -c[onfig] <filename> Alternate 'look and feel' config file\n"
33 " -rc[file] <filename> Alternate keygrab definition file. \n"
34 " (default is ~/.bbkeysrc)\n"
35 " -n[obb] Fall back on default configuration\n"
36 " -v[ersion] Display version number\n"
37 " -h[elp] Display this help\n"
38 " -geom[etry] <geometry> Set geometry of window\n"
39 " -d[ecorated] Show 'normal' decorated window\n"
40 " -w[ithdrawn] Place bbtool in the Slit\n"
41 " -i[conic] Start bbkeys in a minimized state\n"
42 " (will override -withdrawn directive)\n"
43 " -s[hape] Don't display groundplate\n"
44 " -no[qt] Use non-qt configuration tool.\n"
45 " -m[iniMe] Like Austin Powers 2. bbkeys, but smaller.\n"
46 " -t[inyMe] All you can see is his keyhole *sniff*.\n\n");
50 int main(int argc, char **argv)
52 int i;
53 struct CMDOPTIONS options;
54 options.display_name = NULL;
55 options.geometry = NULL;
56 options.withdrawn = False;
57 options.iconic = False;
58 options.shape = False;
59 options.config_file = NULL;
60 options.nobb_config = False;
61 options.decorated = False;
62 options.noQt = False;
63 options.miniMe = False;
64 options.tinyMe = False;
65 options.bbkeysrc = NULL;
67 for (i = 1; i < argc; i++) {
68 if ((!strcmp(argv[i], "-display"))) {
69 if (++i == argc) {
70 Usage();
71 exit(2);
73 options.display_name = argv[i];
74 } else if ((!strcmp(argv[i], "-config")) |
75 (!strcmp(argv[i], "-c"))) {
76 if (++i == argc) {
77 Usage();
78 exit(2);
80 options.config_file = argv[i];
81 } else if((!strcmp(argv[1], "-rcfile"))||
82 (!strcmp(argv[i], "-rc"))){
83 if(++i == argc){
84 Usage();
85 exit(2);
87 options.bbkeysrc=argv[i];
88 } else if ((!strcmp(argv[i], "-nobb")) || (!strcmp(argv[i], "-n"))) {
89 options.nobb_config = True;
90 } else if ((!strcmp(argv[i], "-v"))
91 || (!strcmp(argv[i], "-version"))) {
92 fprintf(stderr, " %s version %s\n", BBTOOL, BBTOOL_VERSION);
93 exit(2);
94 } else if ((!strcmp(argv[i], "-h")) || (!strcmp(argv[i], "-help"))) {
95 Usage();
96 exit(2);
97 } else if ((!strcmp(argv[i], "-geometry"))
98 || (!strcmp(argv[i], "-geom"))) {
99 if (++i == argc) {
100 Usage();
101 exit(2);
103 options.geometry = argv[i];
104 } else if ((!strcmp(argv[i], "-withdrawn"))
105 || (!strcmp(argv[i], "-w"))) {
106 options.withdrawn = True;
107 } else if ((!strcmp(argv[i], "-iconic"))
108 || (!strcmp(argv[i], "-i"))) {
109 options.iconic = True;
110 } else if ((!strcmp(argv[i], "-shape"))
111 || (!strcmp(argv[i], "-s"))) {
112 options.shape = True;
113 } else if ((!strcmp(argv[i], "-decorated"))
114 || (!strcmp(argv[i], "-d"))) {
115 options.decorated = True;
116 } else if ((!strcmp(argv[i], "-noqt"))
117 || (!strcmp(argv[i], "-no"))) {
118 options.noQt = True;
119 } else if ((!strcmp(argv[i], "-miniMe"))
120 || (!strcmp(argv[i], "-m"))) {
121 options.miniMe = True;
122 options.tinyMe = False;
123 } else if ((!strcmp(argv[i], "-tinyMe"))
124 || (!strcmp(argv[i], "-t"))) {
125 options.tinyMe = True;
126 options.miniMe = False;
127 } else {
128 Usage();
129 exit(2);
133 if (options.iconic) {
134 options.withdrawn = False;
137 ToolWindow bbkeys(argc, argv, &options);