3315e8b3 |
1 | /* -*-c-*- |
2 | * |
9796a787 |
3 | * $Id: sw.h,v 1.3 2004/04/08 01:52:19 mdw Exp $ |
3315e8b3 |
4 | * |
5 | * Interface to main options parser |
6 | * |
7 | * (c) 1999 EBI |
8 | */ |
9 | |
10 | /*----- Licensing notice --------------------------------------------------* |
11 | * |
12 | * This file is part of sw-tools. |
13 | * |
14 | * sw-tools is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2 of the License, or |
17 | * (at your option) any later version. |
18 | * |
19 | * sw-tools is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | * GNU General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU General Public License |
25 | * along with sw-tools; if not, write to the Free Software Foundation, |
26 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
27 | */ |
28 | |
3315e8b3 |
29 | #ifndef SW_H |
30 | #define SW_H |
31 | |
32 | #ifdef __cplusplus |
33 | extern "C" { |
34 | #endif |
35 | |
36 | /*----- Data structures ---------------------------------------------------*/ |
37 | |
38 | /* --- About the commands list --- * |
39 | * |
40 | * Declare commands in the header file, like this: |
41 | *@ |
42 | * #ifdef CMD_LINK |
43 | * static cmd cmd_foo = { CMD_LINK, sw_foo, "foo\t\tDoes something." }; |
44 | * # undef CMD_LINK |
45 | * # define CMD_LINK &cmd_foo |
46 | * #endif |
47 | *@ |
48 | * This causes all the commands to be linked together at compile time, and is |
49 | * therefore a cool thing to do. |
50 | */ |
51 | |
52 | typedef struct cmd { |
53 | struct cmd *next; |
54 | const char *name; |
55 | int (*cmd)(int /*argc*/, char */*argv*/[]); |
56 | const char *help; |
57 | } cmd; |
58 | |
59 | /*----- Global variables --------------------------------------------------*/ |
60 | |
61 | extern const char *opt_arch; /* Value of `--arch' option */ |
62 | extern const char *opt_output; /* Value of `--output' option */ |
63 | extern unsigned int opt_flags; /* Various bitflag options */ |
64 | |
65 | enum { |
66 | optFlag_install = 1, |
67 | optFlag_force = 2, |
1efab4fe |
68 | optFlag_beep = 4, |
69 | optFlag_percent = 8 |
3315e8b3 |
70 | }; |
71 | |
72 | /*----- That's all, folks -------------------------------------------------*/ |
73 | |
74 | #ifdef __cplusplus |
75 | } |
76 | #endif |
77 | |
78 | #endif |