1 /* ipkg.c - the itsy package management system
5 Copyright (C) 2001 University of Southern California
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
21 #include "ipkg_conf.h"
24 int main(int argc, const char *argv[])
30 ipkg_conf_t ipkg_conf;
36 optind = args_parse(&args, argc, argv);
37 if (optind == argc || optind < 0) {
38 args_usage("ipkg must have one sub-command argument");
41 cmd_name = argv[optind++];
43 err = ipkg_conf_init(&ipkg_conf, &args);
50 cmd = ipkg_cmd_find(cmd_name);
52 fprintf(stderr, "%s: unknown sub-command %s\n", argv[0], cmd_name);
56 if (cmd->requires_args && optind == argc) {
57 fprintf(stderr, "%s: the ``%s'' command requires at least one argument\n",
58 __FUNCTION__, cmd_name);
62 err = ipkg_cmd_exec(cmd, &ipkg_conf, argc - optind, argv + optind);
65 ipkg_message(ipkg_conf, IPKG_NOTICE, "Succesfully done.\n");
67 ipkg_message(ipkg_conf, IPKG_NOTICE, "Error returned. Return value is %d\n.",err);
72 /* XXX: FEATURE request: run ldconfig and/or depmod after package needing them are installed or removed */
73 // ipkg_global_postinst();
75 ipkg_conf_deinit(&ipkg_conf);