#include "opkg_configure.h"
#include "xsystem.h"
+int opkg_cli_argc = 0;
+char **opkg_cli_argv = NULL;
+
static void print_pkg(pkg_t * pkg)
{
char *version = pkg_version_str_alloc(pkg);
char *description = pkg_get_string(pkg, PKG_DESCRIPTION);
- printf("%s - %s", pkg->name, version);
+ const char *abiver;
+ char *tmp, *tmpname = NULL;
+
+ if (conf->strip_abi &&
+ (abiver = pkg_get_string(pkg, PKG_ABIVERSION)) &&
+ (strlen(pkg->name) > strlen(abiver))) {
+ tmpname = strdup(pkg->name);
+ tmp = &tmpname[strlen(tmpname) - strlen(abiver)];
+ if (!strncmp(abiver, tmp, strlen(abiver)))
+ *tmp = '\0';
+ };
+
+ printf("%s - %s", tmpname?tmpname:pkg->name, version);
+
+ if (tmpname)
+ free(tmpname);
+
if (conf->size)
printf(" - %lu", (unsigned long) pkg_get_int(pkg, PKG_SIZE));
if (description)
char *description = pkg_get_string(pkg, PKG_DESCRIPTION);
char *version = pkg_version_str_alloc(pkg);
struct opkg_list_find_cmd_item *item;
- char *nameptr, *versionptr, *descriptionptr;
+ char *nameptr, *versionptr, *descriptionptr, *tmp;
+ const char *abiver;
int i, found = 0;
/* if we have package name or pattern and pkg does not match, then skip it */
&descriptionptr, description ? strlen(description) + 1 : 0);
item->name = strcpy(nameptr, pkg->name);
+
+ if (conf->strip_abi &&
+ (abiver = pkg_get_string(pkg, PKG_ABIVERSION)) &&
+ (strlen(item->name) > strlen(abiver))) {
+ tmp = &item->name[strlen(item->name) - strlen(abiver)];
+ if (!strncmp(abiver, tmp, strlen(abiver)))
+ *tmp = '\0';
+ };
+
item->size = pkg_get_int(pkg, PKG_SIZE);
item->version = strcpy(versionptr, version);
item->description = description ? strcpy(descriptionptr, description) : NULL;
int opkg_cmd_exec(opkg_cmd_t * cmd, int argc, const char **argv)
{
+ opkg_cli_argc = argc;
+ opkg_cli_argv = argv;
return (cmd->fun) (argc, argv);
}