| 1 | /* -*-c-*- |
| 2 | * |
| 3 | * $Id: sw.h,v 1.1 1999/06/02 16:53:35 mdw Exp $ |
| 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 | |
| 29 | /*----- Revision history --------------------------------------------------* |
| 30 | * |
| 31 | * $Log: sw.h,v $ |
| 32 | * Revision 1.1 1999/06/02 16:53:35 mdw |
| 33 | * Initial revision |
| 34 | * |
| 35 | */ |
| 36 | |
| 37 | #ifndef SW_H |
| 38 | #define SW_H |
| 39 | |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
| 44 | /*----- Data structures ---------------------------------------------------*/ |
| 45 | |
| 46 | /* --- About the commands list --- * |
| 47 | * |
| 48 | * Declare commands in the header file, like this: |
| 49 | *@ |
| 50 | * #ifdef CMD_LINK |
| 51 | * static cmd cmd_foo = { CMD_LINK, sw_foo, "foo\t\tDoes something." }; |
| 52 | * # undef CMD_LINK |
| 53 | * # define CMD_LINK &cmd_foo |
| 54 | * #endif |
| 55 | *@ |
| 56 | * This causes all the commands to be linked together at compile time, and is |
| 57 | * therefore a cool thing to do. |
| 58 | */ |
| 59 | |
| 60 | typedef struct cmd { |
| 61 | struct cmd *next; |
| 62 | const char *name; |
| 63 | int (*cmd)(int /*argc*/, char */*argv*/[]); |
| 64 | const char *help; |
| 65 | } cmd; |
| 66 | |
| 67 | /*----- Global variables --------------------------------------------------*/ |
| 68 | |
| 69 | extern const char *opt_arch; /* Value of `--arch' option */ |
| 70 | extern const char *opt_output; /* Value of `--output' option */ |
| 71 | extern unsigned int opt_flags; /* Various bitflag options */ |
| 72 | |
| 73 | enum { |
| 74 | optFlag_install = 1, |
| 75 | optFlag_force = 2, |
| 76 | optFlag_beep = 4 |
| 77 | }; |
| 78 | |
| 79 | /*----- That's all, folks -------------------------------------------------*/ |
| 80 | |
| 81 | #ifdef __cplusplus |
| 82 | } |
| 83 | #endif |
| 84 | |
| 85 | #endif |