Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Commit Details
Date: | 2010-11-22 00:55:25 (13 years 4 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | a0c0e854cc5792cef05fd838c2da70668ca6cf53 |
Message: | qpkg: option -d to enable debugging at run time, and some cleanup - prereq.c: added section titles - prereq.c (debug), qpkg.h, qpkg.c: made variable "debug" global and moved it to qpkg.c - qpkg.c (usage, main): new option -d to enable debugging |
Files: |
qpkg/prereq.c (4 diffs) qpkg/qpkg.c (3 diffs) qpkg/qpkg.h (1 diff) |
Change Details
qpkg/prereq.c | ||
---|---|---|
39 | 39 | static int n_best; /* undefined if best == NULL */ |
40 | 40 | static int n_install = 0; |
41 | 41 | static int install_max = 0; |
42 | static int debug = 0; | |
42 | ||
43 | ||
44 | /* ----- Version comparison ------------------------------------------------ */ | |
43 | 45 | |
44 | 46 | |
45 | 47 | static int epoch(const char **s, const struct id *id) |
... | ... | |
100 | 102 | } |
101 | 103 | |
102 | 104 | |
105 | /* ----- List of packages considered for installation ---------------------- */ | |
106 | ||
107 | ||
103 | 108 | static void done(void) |
104 | 109 | { |
105 | 110 | int size; |
... | ... | |
139 | 144 | } |
140 | 145 | |
141 | 146 | |
147 | /* ----- Check dependencies and conflicts ---------------------------------- */ | |
148 | ||
149 | ||
142 | 150 | static int satisfies(const struct pkg *pkg, const struct ref *ref) |
143 | 151 | { |
144 | 152 | int cmp; |
... | ... | |
171 | 179 | } |
172 | 180 | |
173 | 181 | |
182 | /* ----- Recurse through lists and layers of dependencies ------------------ */ | |
183 | ||
184 | ||
174 | 185 | static void print_debug(const struct pkg *pkg, const struct stack *top, |
175 | 186 | int level) |
176 | 187 | { |
qpkg/qpkg.c | ||
---|---|---|
26 | 26 | struct tree *packages = NULL; |
27 | 27 | struct tree *versions = NULL; |
28 | 28 | |
29 | int debug = 0; | |
30 | ||
29 | 31 | |
30 | 32 | static void list_all_packages(void) |
31 | 33 | { |
... | ... | |
115 | 117 | static void usage(const char *name) |
116 | 118 | { |
117 | 119 | fprintf(stderr, |
118 | "usage: %s [pkg-list ...] list [pkg]\n" | |
119 | " %s [pkg-list ...] prereq pkg [version]\n" | |
120 | "usage: %s options [pkg-list ...] list [pkg]\n" | |
121 | " %s options [pkg-list ...] prereq pkg [version]\n\n" | |
122 | " -d enable debugging output\n" | |
120 | 123 | , name, name); |
121 | 124 | exit(1); |
122 | 125 | } |
... | ... | |
133 | 136 | usage(*argv); |
134 | 137 | |
135 | 138 | for (arg = 1; arg != argc; arg++) { |
139 | if (!strcmp(argv[arg], "-d")) { | |
140 | debug = 1; | |
141 | continue; | |
142 | } | |
136 | 143 | if (*argv[arg] == '-') |
137 | 144 | usage(*argv); |
138 | 145 | if (!strcmp(argv[arg], "list")) { |
qpkg/qpkg.h | ||
---|---|---|
52 | 52 | struct tree *packages; |
53 | 53 | struct tree *versions; |
54 | 54 | |
55 | int debug; | |
56 | ||
55 | 57 | #endif /* !QPKG_H */ |
Branches:
master