2 * options.c - option parser
4 * Copyright (C) 2003 Draghicioiu Mihai <misuceldestept@go.ro>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
25 #include "wmmemfree.h"
28 char *opt_display
= OPT_DISPLAY
;
29 int opt_buffers
= OPT_BUFFERS
;
30 int opt_cache
= OPT_CACHE
;
31 int opt_window
= OPT_WINDOW
;
32 int opt_shape
= OPT_SHAPE
;
33 int opt_milisecs
= OPT_MILISECS
;
37 printf("Usage: %s [OPTIONS]\n"
38 "-h, --help print this help and exit\n"
39 "-v, --version print version number and exit\n"
40 "-display <DISPLAY> specify the X11 display to connect to\n"
41 "-m, --milisecs <MILISECS> number of miliseconds between updates\n"
42 "-b, --buffers consider buffer memory\n"
43 "-nb, --no-buffers ignore buffer memory\n"
44 "-c, --cache consider cache memory\n"
45 "-nc, --no-cache ignore cache memory\n"
46 "-w, --window run in a window\n"
47 "-nw, --no-window don't run in a window\n"
48 "-s, --shape use the XShape extension\n"
49 "-ns, --no-shape don't use XShape extension\n",
55 printf("WMMemFree version " OPT_VERSION
"\n");
64 if(!strcmp(argv
[n
], "-h") ||
65 !strcmp(argv
[n
], "--help"))
70 else if(!strcmp(argv
[n
], "-v") ||
71 !strcmp(argv
[n
], "--version"))
76 else if(!strcmp(argv
[n
], "-display"))
83 else opt_display
= argv
[n
];
85 else if(!strcmp(argv
[n
], "-m") ||
86 !strcmp(argv
[n
], "--milisecs"))
94 opt_milisecs
= atoi(argv
[n
]);
96 else if(!strcmp(argv
[n
], "-b") ||
97 !strcmp(argv
[n
], "--buffers"))
99 else if(!strcmp(argv
[n
], "-nb") ||
100 !strcmp(argv
[n
], "--no-buffers"))
102 else if(!strcmp(argv
[n
], "-c") ||
103 !strcmp(argv
[n
], "--cache"))
105 else if(!strcmp(argv
[n
], "-nc") ||
106 !strcmp(argv
[n
], "--no-cache"))
108 else if(!strcmp(argv
[n
], "-w") ||
109 !strcmp(argv
[n
], "--window"))
111 else if(!strcmp(argv
[n
], "-nw") ||
112 !strcmp(argv
[n
], "--no-window"))
114 else if(!strcmp(argv
[n
], "-s") ||
115 !strcmp(argv
[n
], "--shape"))
117 else if(!strcmp(argv
[n
], "-ns") ||
118 !strcmp(argv
[n
], "--no-shape"))