opkg: Consolidate error reporting from opkg_conf_init and ensure return value is
[oweals/opkg-lede.git] / libopkg / libopkg.c
index afc42da860185d6ab122c13387eff085ce5e5b99..68da96d355a61184c05f590f71dcb10c7954de16 100644 (file)
@@ -1,4 +1,4 @@
-/* opkglib.c - the itsy package management system
+/* opkglib.c - the opkg package management system
 
    Florina Boor
 
@@ -15,7 +15,6 @@
    General Public License for more details.
 */
 
-#include "opkg.h"
 #include "includes.h"
 #include "libopkg.h"
 
 #include "opkg_cmd.h"
 #include "file_util.h"
 
+#include "opkg_message.h"
+#include "opkg_error.h"
 
-
-opkg_message_callback opkg_cb_message = NULL;
-opkg_response_callback opkg_cb_response = NULL;
 opkg_status_callback opkg_cb_status = NULL;
 opkg_list_callback opkg_cb_list = NULL;
 
@@ -273,6 +271,7 @@ opkg_packages_download (args_t * args, const char *name)
        err = opkg_conf_init (&opkg_conf, args);
        if (err)
        {
+               opkg_print_error_list (&opkg_conf);
                return err;
        }
 
@@ -479,18 +478,20 @@ opkg_op (int argc, char *argv[])
              !strcmp(cmd_name,"status") )
            args.noreadfeedsfile = 1;
 
+       opkg_cb_message = default_opkg_message_callback;
+       opkg_cb_response = default_opkg_response_callback;
+       opkg_cb_status = default_opkg_status_callback;
+
 
        err = opkg_conf_init (&opkg_conf, &args);
        if (err)
        {
+               opkg_print_error_list (&opkg_conf);
                return err;
        }
 
        args_deinit (&args);
 
-       opkg_cb_message = default_opkg_message_callback;
-       opkg_cb_response = default_opkg_response_callback;
-       opkg_cb_status = default_opkg_status_callback;
        if ( strcmp(cmd_name, "files")==0)
             opkg_cb_list = default_opkg_files_callback;
        else