Process all option structs that match a given arg.
This lets us handle options such as -i that have different meanings
depending on what other options are present on the command line.
2 * Copyright (C) 2008 Kristian Høgsberg <krh@redhat.com>
3 * Copyright (C) 2008 Red Hat, Inc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 enum option_type type;
37 const char *description;
41 /* A note about all these options: rpm allows options to mean
42 * different things depending on what other options are present on the
43 * command line. For example, if -q or --query is present, -i no
44 * longer means install, but info. The way we handle this is by
45 * setting all the options that may match (ie if -i is given we set
46 * install and info), and then look at the relevent one depending on
47 * what else in on the command line. */
49 static int option_all, option_whatrequires, option_whatprovides;
50 static int option_package;
52 static const struct option query_options[] = {
53 { OPTION_BOOL, "configfiles", 'c', NULL, "list all configuration files", NULL },
54 { OPTION_BOOL, "docfiles", 'd', NULL, "list all documentation files", NULL },
55 { OPTION_BOOL, "dump", 0, NULL, "dump basic file information", NULL },
56 { OPTION_BOOL, "list", 0, NULL, "list files in package", NULL },
57 { OPTION_STRING, "queryformat", 0, "QUERYFORMAT", "use the following query format", NULL },
58 { OPTION_BOOL, "state", 's', NULL, "display the states of the listed files", NULL },
59 { OPTION_BOOL, "all", 'a', NULL, "query/verify all packages", &option_all },
60 { OPTION_BOOL, "file", 'f', NULL, "query/verify package(s) owning file", NULL },
61 { OPTION_BOOL, "group", 'g', NULL, "query/verify package(s) in group", NULL },
62 { OPTION_BOOL, "package", 'p', NULL, "query/verify a package file", &option_package },
63 { OPTION_BOOL, "ftswalk", 'W', NULL, "query/verify package(s) from TOP file tree walk", NULL },
64 { OPTION_BOOL, "pkgid", 0, NULL, "query/verify package(s) with package identifier", NULL },
65 { OPTION_BOOL, "hdrid", 0, NULL, "query/verify package(s) with header identifier", NULL },
66 { OPTION_BOOL, "fileid", 0, NULL, "query/verify package(s) with file identifier", NULL },
67 { OPTION_BOOL, "specfile", 0, NULL, "query a spec file", NULL, },
68 { OPTION_BOOL, "triggeredby", 0, NULL, "query the package(s) triggered by the package", NULL },
69 { OPTION_BOOL, "whatrequires", 0, NULL, "query/verify the package(s) which require a dependency", &option_whatrequires },
70 { OPTION_BOOL, "whatprovides", 0, NULL, "query/verify the package(s) which provide a dependency", &option_whatprovides },
71 { OPTION_BOOL, "nomanifest", 0, NULL, "do not process non-package files as manifests", NULL },
75 static const struct option verify_options[] = {
76 { OPTION_BOOL, "nomd5", 0, NULL, "don't verify MD5 digest of files", NULL },
77 { OPTION_BOOL, "nofiles", 0, NULL, "don't verify files in package", NULL },
78 { OPTION_BOOL, "nodeps", 0, NULL, "don't verify package dependencies", NULL },
79 { OPTION_BOOL, "noscript", 0, NULL, "don't execute verify script(s)", NULL, },
80 { OPTION_BOOL, "all", 'a', NULL, "query/verify all packages", NULL },
81 { OPTION_BOOL, "file", 'f', NULL, "query/verify package(s) owning file", NULL },
82 { OPTION_BOOL, "group", 'g', NULL, "query/verify package(s) in group", NULL },
83 { OPTION_BOOL, "package", 'p', NULL, "query/verify a package file", NULL },
84 { OPTION_BOOL, "ftswalk", 'W', NULL, "query/verify package(s) from TOP file tree walk", NULL },
85 { OPTION_BOOL, "pkgid", 0, NULL, "query/verify package(s) with package identifier", NULL },
86 { OPTION_BOOL, "hdrid", 0, NULL, "query/verify package(s) with header identifier", NULL },
87 { OPTION_BOOL, "fileid", 0, NULL, "query/verify package(s) with file identifier", NULL },
88 { OPTION_BOOL, "specfile", 0, NULL, "query a spec file", NULL },
89 { OPTION_BOOL, "triggeredby", 0, NULL, "query the package(s) triggered by the package", NULL },
90 { OPTION_BOOL, "whatrequires", 0, NULL, "query/verify the package(s) which require a dependency", &option_whatrequires },
91 { OPTION_BOOL, "whatprovides", 0, NULL, "query/verify the package(s) which provide a dependency", &option_whatprovides },
92 { OPTION_BOOL, "nomanifest", 0, NULL, "do not process non-package files as manifests", NULL },
96 static const struct option ftw_options[] = {
97 { OPTION_BOOL, "comfollow", 0, NULL, "FTS_COMFOLLOW: follow command line symlinks", NULL },
98 { OPTION_BOOL, "logical", 0, NULL, "FTS_LOGICAL: logical walk", NULL },
99 { OPTION_BOOL, "nochdir", 0, NULL, "FTS_NOCHDIR: don't change directories", NULL },
100 { OPTION_BOOL, "nostat", 0, NULL, "FTS_NOSTAT: don't get stat info", NULL },
101 { OPTION_BOOL, "physical", 0, NULL, "FTS_PHYSICAL: physical walk", NULL },
102 { OPTION_BOOL, "seedot", 0, NULL, "FTS_SEEDOT: return dot and dot-dot", NULL },
103 { OPTION_BOOL, "xdev", 0, NULL, "FTS_XDEV: don't cross devices", NULL },
104 { OPTION_BOOL, "whiteout", 0, NULL, "FTS_WHITEOUT: return whiteout information", NULL },
108 static const struct option signature_options[] = {
109 { OPTION_BOOL, "addsign", 0, NULL, "sign package(s) (identical to --resign)", NULL, },
110 { OPTION_BOOL, "checksig", 'K', NULL, "verify package signature(s)", NULL, },
111 { OPTION_BOOL, "delsign", 0, NULL, "delete package signatures", NULL, },
112 { OPTION_BOOL, "import", 0, NULL, "import an armored public key", NULL, },
113 { OPTION_BOOL, "resign", 0, NULL, "sign package(s) (identical to --addsign)", NULL, },
114 { OPTION_BOOL, "nodigest", 0, NULL, "don't verify package digest(s)", NULL, },
115 { OPTION_BOOL, "nosignature", 0, NULL, "don't verify package signature(s)", NULL },
119 static const struct option database_options[] = {
120 { OPTION_BOOL, "initdb", 0, NULL, "initialize database", NULL },
121 { OPTION_BOOL, "rebuilddb", 0, NULL, "rebuild database inverted lists from installed package headers", NULL },
125 static int option_erase, option_install, option_upgrade;
127 static const struct option install_options[] = {
128 { OPTION_BOOL, "aid", 0, NULL, "add suggested packages to transaction", NULL, },
129 { OPTION_BOOL, "allfiles", 0, NULL, "install all files, even configurations which might otherwise be skipped", NULL, },
130 { OPTION_BOOL, "allmatches", 0, NULL, "remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)", NULL, },
131 { OPTION_BOOL, "badreloc", 0, NULL, "relocate files in non-relocatable package", NULL },
132 { OPTION_BOOL, "erase", 'e', "<package>", "erase (uninstall) package", &option_erase },
133 { OPTION_BOOL, "excludedocs", 0, NULL, "do not install documentation", NULL, },
134 { OPTION_BOOL, "excludepath", 0, "<path>", "skip files with leading component <path> ", NULL, },
135 { OPTION_BOOL, "fileconflicts", 0, NULL, "detect file conflicts between packages", NULL, },
136 { OPTION_BOOL, "force", 0, NULL, "short hand for --replacepkgs --replacefiles", NULL },
137 { OPTION_BOOL, "freshen", 'F', "<packagefile>+", "upgrade package(s) if already installed", NULL },
138 { OPTION_BOOL, "hash", 'h', NULL, "print hash marks as package installs (good with -v)", NULL },
139 { OPTION_BOOL, "ignorearch", 0, NULL, "don't verify package architecture", NULL, },
140 { OPTION_BOOL, "ignoreos", 0, NULL, "don't verify package operating system", NULL, },
141 { OPTION_BOOL, "ignoresize", 0, NULL, "don't check disk space before installing", NULL },
142 { OPTION_BOOL, "install", 'i', NULL, "install package(s)", &option_install },
143 { OPTION_BOOL, "justdb", 0, NULL, "update the database, but do not modify the filesystem", NULL, },
144 { OPTION_BOOL, "nodeps", 0, NULL, "do not verify package dependencies", NULL, },
145 { OPTION_BOOL, "nomd5", 0, NULL, "don't verify MD5 digest of files", NULL, },
146 { OPTION_BOOL, "nocontexts", 0, NULL, "don't install file security contexts", NULL, },
147 { OPTION_BOOL, "noorder", 0, NULL, "do not reorder package installation to satisfy dependencies", NULL, },
148 { OPTION_BOOL, "nosuggest", 0, NULL, "do not suggest missing dependency resolution(s)", NULL, },
149 { OPTION_BOOL, "noscripts", 0, NULL, "do not execute package scriptlet(s)", NULL, },
150 { OPTION_BOOL, "notriggers", 0, NULL, "do not execute any scriptlet(s) triggered by this package", NULL, },
151 { OPTION_BOOL, "oldpackage", 0, NULL, "upgrade to an old version of the package (--force on upgrades does this automatically)", NULL },
152 { OPTION_BOOL, "percent", 0, NULL, "print percentages as package installs", NULL, },
153 { OPTION_STRING, "prefix", 0, "<dir>", "relocate the package to <dir>, if relocatable", NULL, },
154 { OPTION_STRING, "relocate", 0, "<old>=<new>", "relocate files from path <old> to <new>", NULL, },
155 { OPTION_BOOL, "repackage", 0, NULL, "save erased package files by repackaging", NULL, },
156 { OPTION_BOOL, "replacefiles", 0, NULL, "ignore file conflicts between packages", NULL, },
157 { OPTION_BOOL, "replacepkgs", 0, NULL, "reinstall if the package is already present", NULL, },
158 { OPTION_BOOL, "test", 0, NULL, "don't install, but tell if it would work or not", NULL },
159 { OPTION_BOOL, "upgrade", 'U', "<packagefile>+", "upgrade package(s)", &option_upgrade },
163 static int option_version;
165 static const struct option common_options[] = {
166 { OPTION_STRING, "define", 'D', "MACRO EXPR", "define MACRO with value EXPR", NULL, },
167 { OPTION_STRING, "eval", 'E', "EXPR", "print macro expansion of EXPR", NULL },
168 { OPTION_STRING, "macros", 0, "<FILE:...>", "read <FILE:...> instead of default file(s)", NULL },
169 { OPTION_BOOL, "nodigest", 0, NULL, "don't verify package digest(s)", NULL, },
170 { OPTION_BOOL, "nosignature", 0, NULL, "don't verify package signature(s)", NULL, },
171 { OPTION_STRING, "rcfile", 0, "<FILE:...>", "read <FILE:...> instead of default file(s)", NULL },
172 { OPTION_STRING, "root", 'r', "ROOT", "use ROOT as top level directory (default: \"/\")", NULL },
173 { OPTION_BOOL, "querytags", 0, NULL, "display known query tags", NULL, },
174 { OPTION_BOOL, "showrc", 0, NULL, "display final rpmrc and macro configuration", NULL, },
175 { OPTION_BOOL, "quiet", 0, NULL, "provide less detailed output", NULL },
176 { OPTION_BOOL, "verbose", 'v', NULL, "provide more detailed output", NULL },
177 { OPTION_BOOL, "version", 0, NULL, "print the version of rpm being used", &option_version },
181 static int option_conflicts, option_obsoletes, option_requires;
182 static int option_provides, option_info, option_changelog;
184 static const struct option alias_options[] = {
185 { OPTION_BOOL, "scripts", 0, NULL, "list install/erase scriptlets from package(s)", NULL, },
186 { OPTION_BOOL, "setperms", 0, NULL, "set permissions of files in a package", NULL, },
187 { OPTION_BOOL, "setugids", 0, NULL, "set user/group ownership of files in a package", NULL, },
188 { OPTION_BOOL, "conflicts", 0, NULL, "list capabilities this package conflicts with", &option_conflicts, },
189 { OPTION_BOOL, "obsoletes", 0, NULL, "list other packages removed by installing this package", &option_obsoletes, },
190 { OPTION_BOOL, "provides", 0, NULL, "list capabilities that this package provides", &option_provides, },
191 { OPTION_BOOL, "requires", 0, NULL, "list capabilities required by package(s)", &option_requires, },
192 { OPTION_BOOL, "info", 'i', NULL, "list descriptive information from package(s)", &option_info, },
193 { OPTION_BOOL, "changelog", 0, NULL, "list change logs for this package", &option_changelog, },
194 { OPTION_BOOL, "xml", 0, NULL, "list metadata in xml", NULL, },
195 { OPTION_BOOL, "triggers", 0, NULL, "list trigger scriptlets from package(s)", NULL, },
196 { OPTION_BOOL, "last", 0, NULL, "list package(s) by install time, most recent first", NULL, },
197 { OPTION_BOOL, "dupes", 0, NULL, "list duplicated packages", NULL, },
198 { OPTION_BOOL, "filesbypkg", 0, NULL, "list all files from each package", NULL, },
199 { OPTION_BOOL, "fileclass", 0, NULL, "list file names with classes", NULL, },
200 { OPTION_BOOL, "filecolor", 0, NULL, "list file names with colors", NULL, },
201 { OPTION_BOOL, "filecontext", 0, NULL, "list file names with security context from header", NULL, },
202 { OPTION_BOOL, "fscontext", 0, NULL, "list file names with security context from file system", NULL, },
203 { OPTION_BOOL, "recontext", 0, NULL, "list file names with security context from policy RE", NULL, },
204 { OPTION_BOOL, "fileprovide", 0, NULL, "list file names with provides", NULL, },
205 { OPTION_BOOL, "filerequire", 0, NULL, "list file names with requires", NULL, },
206 { OPTION_BOOL, "redhatprovides", 0, NULL, "find package name that contains a provided capability (needs rpmdb-redhat package installed)", NULL, },
207 { OPTION_BOOL, "redhatrequires", 0, NULL, "find package name that contains a required capability (needs rpmdb-redhat package installed)", NULL, },
208 { OPTION_STRING, "buildpolicy", 0, "<policy>", "set buildroot <policy> (e.g. compress man pages)", NULL, },
209 { OPTION_BOOL, "with", 0, "<option>", "enable configure <option> for build", NULL, },
210 { OPTION_BOOL, "without", 0, "<option>", "disable configure <option> for build", NULL },
214 static int option_help, option_usage;
216 static const struct option help_options[] = {
217 { OPTION_BOOL, "help", '?', NULL, "Show this help message", &option_help },
218 { OPTION_BOOL, "usage", 0, NULL, "Display brief usage message", &option_usage},
222 static int option_query, option_verify;
224 static const struct option rpm_options[] = {
225 { OPTION_BOOL, "query", 'q', NULL, "Query rpm database", &option_query },
226 { OPTION_BOOL, "verify", 'V', NULL, "Verify rpm database", &option_verify },
227 { OPTION_GROUP, NULL, 0, NULL, "Query options (with -q or --query):", &query_options },
228 { OPTION_GROUP, NULL, 0, NULL, "Verify options (with -V or --verify):", &verify_options },
229 { OPTION_GROUP, NULL, 0, NULL, "File tree walk options (with --ftswalk):", &ftw_options },
230 { OPTION_GROUP, NULL, 0, NULL, "Signature options:", &signature_options },
231 { OPTION_GROUP, NULL, 0, NULL, "Database options:", &database_options },
232 { OPTION_GROUP, NULL, 0, NULL, "Install/Upgrade/Erase options:", &install_options },
233 { OPTION_GROUP, NULL, 0, NULL, "Common options for all rpm modes and executables:", &common_options },
234 { OPTION_GROUP, NULL, 0, NULL, "Options implemented via popt alias/exec:", &alias_options },
235 { OPTION_GROUP, NULL, 0, NULL, "Help options", &help_options },
239 static const char system_repo_filename[] = "system.repo";
240 static const char *repo_filename = system_repo_filename;
242 static struct razor_property *
243 add_property_packages(struct razor_set *set,
244 struct razor_package_query *query,
245 const char *ref_name,
246 const char *ref_version,
247 enum razor_property_type ref_type)
249 struct razor_property *property;
250 struct razor_property_iterator *pi;
251 struct razor_package_iterator *pkgi;
252 const char *name, *version;
253 enum razor_property_type type;
254 enum razor_version_relation relation;
256 pi = razor_property_iterator_create(set, NULL);
257 while (razor_property_iterator_next(pi, &property, &name,
258 &relation, &version, &type)) {
259 if (strcmp(ref_name, name) != 0)
261 if (ref_version && relation == RAZOR_VERSION_EQUAL &&
262 strcmp(ref_version, version) != 0)
264 if (ref_type != type)
267 pkgi = razor_package_iterator_create_for_property(set,
269 razor_package_query_add_iterator(query, pkgi);
270 razor_package_iterator_destroy(pkgi);
272 razor_property_iterator_destroy(pi);
278 strcmpp(const void *p1, const void *p2)
280 return strcmp(*(char * const *) p1, *(char * const *) p2);
284 add_command_line_packages(struct razor_set *set,
285 struct razor_package_query *query,
286 int argc, const char **argv)
288 struct razor_package *package;
289 struct razor_package_iterator *pi;
290 const char *name, *version, *arch;
293 qsort(argv, argc, sizeof(*argv), strcmpp);
296 pi = razor_package_iterator_create(set);
298 while (razor_package_iterator_next(pi, &package,
299 &name, &version, &arch)) {
300 while (cmp = strcmp(argv[i], name), cmp < 0 && i < argc) {
301 printf("package %s is not installed\n", argv[i]);
306 razor_package_query_add_package(query, package);
311 razor_package_iterator_destroy(pi);
315 print_package_properties(struct razor_set *set,
316 struct razor_package *package,
317 enum razor_property_type ref_type)
319 struct razor_property *property;
320 struct razor_property_iterator *pi;
321 const char *name, *version;
322 enum razor_property_type type;
323 enum razor_version_relation relation;
325 pi = razor_property_iterator_create(set, package);
326 while (razor_property_iterator_next(pi, &property,
327 &name, &relation, &version,
329 if (type != ref_type)
331 if (version[0] == '\0')
332 printf("%s\n", name);
334 printf("%s %s %s\n", name,
335 razor_version_relations[relation], version);
337 razor_property_iterator_destroy(pi);
341 print_package_info(struct razor_set *set, struct razor_package *package)
343 printf("FIXME: Package info not tracked.\n");
347 print_package_changelog(struct razor_set *set, struct razor_package *package)
349 printf("FIXME: Package changelog not tracked.\n");
352 static struct razor_set *
353 create_set_from_command_line(int argc, const char *argv[])
355 struct razor_importer *importer;
356 struct razor_rpm *rpm;
359 importer = razor_importer_new();
361 for (i = 0; i < argc; i++) {
362 rpm = razor_rpm_open(argv[i]);
365 if (razor_importer_add_rpm(importer, rpm))
366 printf("couldn't import %s\n", argv[i]);
368 razor_rpm_close(rpm);
371 return razor_importer_finish(importer);
375 command_query(int argc, const char *argv[])
377 struct razor_set *set;
378 struct razor_package_iterator *pi;
379 struct razor_package *package;
380 struct razor_package_query *query;
381 const char *name, *version, *arch;
383 if (option_package) {
384 set = create_set_from_command_line(argc, argv);
388 set = razor_set_open(repo_filename);
391 if (option_all + option_whatprovides + option_whatrequires > 1) {
392 printf("only one type of query/verify "
393 "may be performed at a time\n");
397 query = razor_package_query_create(set);
399 pi = razor_package_iterator_create(set);
400 razor_package_query_add_iterator(query, pi);
401 razor_package_iterator_destroy(pi);
402 } else if (option_whatrequires) {
403 add_property_packages(set, query,
404 argv[0], NULL, RAZOR_PROPERTY_REQUIRES);
405 } else if (option_whatprovides) {
406 add_property_packages(set, query,
407 argv[0], NULL, RAZOR_PROPERTY_PROVIDES);
408 } else if (argc > 0) {
409 add_command_line_packages(set, query, argc, argv);
411 printf("no arguments given for query\n");
415 pi = razor_package_query_finish(query);
417 while (razor_package_iterator_next(pi, &package,
418 &name, &version, &arch)) {
419 if (option_conflicts)
420 print_package_properties(set, package,
421 RAZOR_PROPERTY_CONFLICTS);
422 if (option_obsoletes)
423 print_package_properties(set, package,
424 RAZOR_PROPERTY_OBSOLETES);
426 print_package_properties(set, package,
427 RAZOR_PROPERTY_REQUIRES);
429 print_package_properties(set, package,
430 RAZOR_PROPERTY_PROVIDES);
432 print_package_info(set, package);
433 if (option_changelog)
434 print_package_changelog(set, package);
436 if (option_conflicts + option_obsoletes +
437 option_requires + option_provides +
438 option_info + option_changelog == 0)
439 printf("%s-%s.%s\n", name, version, arch);
442 razor_package_iterator_destroy(pi);
444 razor_set_destroy(set);
450 command_verify(int argc, const char *argv[])
453 printf("no arguments given for verify\n");
457 printf("command verify - not implemented\n");
461 command_erase(int argc, const char *argv[])
464 printf("no packages given for erase\n");
468 printf("command erase - not implemented\n");
472 command_install(int argc, const char *argv[])
475 printf("no packages given for install\n");
479 printf("command install - not implemented\n");
483 command_update(int argc, const char *argv[])
486 printf("no packages given for update\n");
490 printf("command update - not implemented\n");
494 for_each_option(const struct option *options, const char *s,
495 void (*fn)(const struct option *o,
496 const char *arg, void *data), void *data)
500 for (i = 0; options[i].type != OPTION_LAST; i++) {
501 switch (options[i].type) {
503 count += for_each_option(options[i].data, s, fn, data);
509 s[1] == options[i].short_name && s[2] == '\0') {
510 fn(&options[i], s, data);
513 if (s[0] == '-' && s[1] == '-' &&
514 strcmp(options[i].name, s + 2) == 0) {
515 fn(&options[i], s, data);
529 handle_option(const struct option *o, const char *arg, void *data)
531 if (o->data == NULL) {
532 printf("option \"%s\" not supported\n", arg);
538 *(int *) o->data = 1;
542 *(const char **) o->data = arg + strlen(o->name) + 3;
547 /* Shouldn't happen. */
553 parse_options(const struct option *options, int argc, const char **argv)
557 /* FIXME: Bundling... rpm -Uvh must work :) */
559 for (i = 1, j = 0; i < argc; i++) {
560 if (argv[i][0] != '-') {
565 if (for_each_option(options, argv[i],
566 handle_option, NULL) == 0) {
567 printf("unknown option: \"%s\"\n", argv[i]);
576 print_options_help(const struct option *options)
580 for (i = 0; options[i].type != OPTION_LAST; i++) {
581 switch (options[i].type) {
583 printf("%s\n", options[i].description);
584 print_options_help(options[i].data);
591 if (options[i].short_name)
592 printf("-%c", options[i].short_name);
593 if (options[i].short_name && options[i].name)
596 printf("--%s", options[i].name);
597 if (options[i].arg_name)
598 printf("=%s", options[i].arg_name);
599 if (options[i].description)
600 printf("\t\t%s", options[i].description);
611 print_options_usage(const struct option *options)
615 for (i = 0; options[i].type != OPTION_LAST; i++) {
616 switch (options[i].type) {
618 print_options_usage(options[i].data);
623 if (options[i].short_name)
624 printf("-%c", options[i].short_name);
625 if (options[i].short_name && options[i].name)
628 printf("--%s", options[i].name);
634 if (options[i].short_name)
635 printf("-%c", options[i].short_name);
636 if (options[i].short_name && options[i].name)
639 printf("--%s", options[i].name);
640 if (options[i].arg_name)
641 printf("=%s", options[i].arg_name);
655 main(int argc, const char *argv[])
657 argc = parse_options(rpm_options, argc, argv);
659 if (option_version) {
660 printf("razor rpm version hoopla.\n");
665 printf("Usage: rpm [OPTION...]\n");
666 print_options_help(rpm_options);
671 printf("Usage: rpm [OPTION...]\n");
672 print_options_usage(rpm_options);
678 command_verify(argc, argv);
679 } else if (option_query) {
680 command_query(argc, argv);
681 } else if (option_install) {
682 command_install(argc, argv);
683 } else if (option_upgrade) {
684 command_update(argc, argv);
685 } else if (option_erase) {
686 command_erase(argc, argv);
688 print_options_usage(rpm_options);