opkg: fix gpg enabled builds and fix one compiler warning
[oweals/opkg-lede.git] / args.h
1 /* args.h - parse command-line args
2
3   Carl D. Worth
4
5   Copyright 2001 University of Southern California
6  
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2, or (at your option)
10   any later version.
11  
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16 */
17
18 #ifndef ARGS_H
19 #define ARGS_H
20
21 struct args
22 {
23     char *conf_file;
24     char *dest;
25     char *tmp_dir;
26     int force_defaults;
27     int force_depends;
28     int force_overwrite;
29     int force_downgrade;
30     int force_reinstall;
31     int force_removal_of_essential_packages;
32     int force_removal_of_dependent_packages;
33     int force_space;
34     int noaction;
35     int nodeps;
36     int multiple_providers;
37     int query_all;
38     int verbose_wget;
39     int verbosity;
40     int nocheckfordirorfile;
41     int noreadfeedsfile;
42     char *offline_root;
43     char *offline_root_pre_script_cmd;
44     char *offline_root_post_script_cmd;
45 };
46 typedef struct args args_t;
47
48 #define ARGS_DEFAULT_CONF_FILE_DIR "/etc"
49 #define ARGS_DEFAULT_CONF_FILE_NAME "opkg.conf"
50 #define ARGS_DEFAULT_DEST NULL
51 #define ARGS_DEFAULT_FORCE_DEFAULTS 0
52 #define ARGS_DEFAULT_FORCE_DEPENDS 0
53 #define ARGS_DEFAULT_FORCE_OVERWRITE 0 
54 #define ARGS_DEFAULT_FORCE_DOWNGRADE 0 
55 #define ARGS_DEFAULT_FORCE_REINSTALL 0
56 #define ARGS_DEFAULT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES 0
57 #define ARGS_DEFAULT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES 0
58 #define ARGS_DEFAULT_FORCE_SPACE 0
59 #define ARGS_DEFAULT_OFFLINE_ROOT NULL
60 #define ARGS_DEFAULT_OFFLINE_ROOT_PRE_SCRIPT_CMD NULL
61 #define ARGS_DEFAULT_OFFLINE_ROOT_POST_SCRIPT_CMD NULL
62 #define ARGS_DEFAULT_NOACTION 0
63 #define ARGS_DEFAULT_NODEPS 0
64 #define ARGS_DEFAULT_VERBOSE_WGET 0
65 #define ARGS_DEFAULT_VERBOSITY 1
66
67 int args_init(args_t *args);
68 void args_deinit(args_t *args);
69 int args_parse(args_t *args, int argc, char *argv[]);
70 void args_usage(char *complaint);
71
72 #endif