$(opkg_cmd_sources) $(opkg_db_sources) \
$(opkg_util_sources) $(opkg_list_sources)
-libopkg_la_CFLAGS = -DOPKG_LIB $(ALL_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS)
+libopkg_la_CFLAGS = $(ALL_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS)
lib_LTLIBRARIES = libopkg.la
fprintf(stderr, "\tlist_installed List all and only the installed packages and description \n");
fprintf(stderr, "\tfiles <pkg> List all files belonging to <pkg>\n");
fprintf(stderr, "\tsearch <file|regexp> Search for a package providing <file>\n");
-#ifndef OPKG_LIB
- fprintf(stderr, "\tinfo [pkg|regexp [<field>]] Display all/some info fields for <pkg> or all\n");
- fprintf(stderr, "\tstatus [pkg|regexp [<field>]] Display all/some status fields for <pkg> or all\n");
-#else
fprintf(stderr, "\tinfo [pkg|regexp] Display all info for <pkg>\n");
fprintf(stderr, "\tstatus [pkg|regexp] Display all status for <pkg>\n");
-#endif
fprintf(stderr, "\tdownload <pkg> Download <pkg> to current directory.\n");
fprintf(stderr, "\tcompare_versions <v1> <op> <v2>\n");
fprintf(stderr, "\t compare versions using <= < > >= = << >>\n");
General Public License for more details.
*/
-#ifdef OPKG_LIB
-
#include "opkg.h"
#include "includes.h"
#include "libopkg.h"
if (conf && (conf->verbosity < level)) {
return 0;
} else {
-#ifdef OPKG_LIB
if ( level == OPKG_ERROR ){
push_error_list(&error_list, msg);
-// printf(msg);
} else
-#endif
printf(msg);
}
return 0;
return err;
}
-
-#endif /* OPKG_LIB */
#endif
-#ifdef OPKG_LIB
-
#include "opkg_conf.h"
#include "opkg_message.h"
#include "opkg_state.h"
extern void free_error_list();
#endif
-
-
-#endif
#include "opkg_configure.h"
#include "opkg_message.h"
-#ifdef OPKG_LIB
#include "libopkg.h"
static void *p_userdata = NULL;
-#endif
static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv);
static int opkg_upgrade_cmd(opkg_conf_t *conf, int argc, char **argv);
return NULL;
}
-#ifdef OPKG_LIB
int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **argv, void *userdata)
{
int result;
p_userdata = NULL;
return result;
}
-#else
-int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **argv)
-{
- return (cmd->fun)(conf, argc, argv);
-}
-#endif
static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv)
{
if (newline) {
*newline = '\0';
}
-#ifndef OPKG_LIB
- printf("%s - %s\n", pkg->name, desc_short);
-#else
if (opkg_cb_list) {
version_str = pkg_version_str_alloc(pkg);
opkg_cb_list(pkg->name,desc_short,
p_userdata);
free(version_str);
}
-#endif
}
pkg_vec_free(available);
if (newline) {
*newline = '\0';
}
-#ifndef OPKG_LIB
- printf("%s - %s\n", pkg->name, desc_short);
-#else
if (opkg_cb_list) {
version_str = pkg_version_str_alloc(pkg);
opkg_cb_list(pkg->name,desc_short,
p_userdata);
free(version_str);
}
-#endif
}
return 0;
if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) {
continue;
}
-#ifndef OPKG_LIB
- if (n_fields) {
- for (j = 0; j < n_fields; j++)
- pkg_print_field(pkg, stdout, pkg_fields[j]);
- } else {
- pkg_print_info(pkg, stdout);
- }
-#else
buff = pkg_formatted_info(pkg);
if ( buff ) {
*/
free(buff);
}
-#endif
if (conf->verbosity > 1) {
conffile_list_elt_t *iter;
for (iter = pkg->conffiles.head; iter; iter = iter->next) {
}
}
}
-#ifndef OPKG_LIB
- if (buff)
- free(buff);
-#endif
pkg_vec_free(available);
return 0;
installed_files = pkg_get_installed_files(pkg);
pkg_version = pkg_version_str_alloc(pkg);
-#ifndef OPKG_LIB
- printf("Package %s (%s) is installed on %s and has the following files:\n",
- pkg->name, pkg_version, pkg->dest->name);
- for (iter = installed_files->head; iter; iter = iter->next) {
- puts(iter->data);
- }
-#else
if (buff) {
try_again:
used_len = snprintf(buff, buff_len, "Package %s (%s) is installed on %s and has the following files:\n",
p_userdata);
free(buff);
}
-#endif
free(pkg_version);
pkg_free_installed_files(pkg);
for (iter = installed_files->head; iter; iter = iter->next) {
installed_file = iter->data;
if (fnmatch(argv[0], installed_file, 0)==0) {
-#ifndef OPKG_LIB
- printf("%s: %s\n", pkg->name, installed_file);
-#else
if (opkg_cb_list) opkg_cb_list(pkg->name,
installed_file,
pkg_version_str_alloc(pkg),
pkg->state_status, p_userdata);
-#endif
}
}
typedef struct opkg_cmd opkg_cmd_t;
opkg_cmd_t *opkg_cmd_find(const char *name);
-#ifdef OPKG_LIB
int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc,
const char **argv, void *userdata);
-#else
-int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **argv);
-#endif
int opkg_multiple_files_scan (opkg_conf_t *conf, int argc, char *argv[]);
/* install any packges with state_want == SW_INSTALL */
int opkg_install_wanted_packages(opkg_conf_t *conf);
#include "file_util.h"
#include "str_util.h"
-#ifdef OPKG_LIB
#include "libopkg.h"
opkg_download_progress_callback opkg_cb_download_progress = NULL;
-#endif
int
curl_progress_func (char* url,
int i;
int p = (t) ? d*100/t : 0;
-#ifdef OPKG_LIB
if (opkg_cb_download_progress)
{
static int prev = -1;
opkg_cb_download_progress (p, url);
return 0;
}
-#endif
/* skip progress bar if we haven't done started yet
* this prevents drawing the progress bar if we receive an error such as
#include "opkg_conf.h"
#include "opkg_message.h"
-#ifndef OPKG_LIB
-
-void
-opkg_message (opkg_conf_t * conf, message_level_t level, char *fmt, ...)
-{
- va_list ap;
-
- if (conf && (conf->verbosity < level))
- {
- return;
- }
- else
- {
-
- va_start (ap, fmt);
- vprintf (fmt, ap);
- va_end (ap);
- }
-}
-
-#else
-
#include "libopkg.h"
//#define opkg_message(conf, level, fmt, arg...) opkg_cb_message(conf, level, fmt, ## arg)
opkg_cb_message(conf,level,ts);
}
}
-#endif
#include <stdarg.h>
#include "file_util.h"
#include "str_util.h"
-#ifdef OPKG_LIB
#include "libopkg.h"
-#endif
-#ifdef OPKG_LIB
static char *question = NULL;
static int question_len = 255;
-#endif
+
char *get_user_response(const char *format, ...)
{
int len = question_len;
char *response;
va_start(ap, format);
-#ifndef OPKG_LIB
- vprintf(format, ap);
- do {
- response = file_read_line_alloc(stdin);
- } while (response == NULL);
-#else
do {
if (question == NULL || len > question_len) {
question = realloc(question, len + 1);
len = vsnprintf(question,question_len,format,ap);
} while (len > question_len);
response = strdup(opkg_cb_response(question));
-#endif
str_chomp(response);
str_tolower(response);
#lib_LTLIBRARIES = libopkg.la
opkg_cl_SOURCES = opkg-frontend.c
-opkg_cl_CFLAGS = -DOPKG_LIB $(ALL_CFLAGS)
+opkg_cl_CFLAGS = $(ALL_CFLAGS)
opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.la \
$(top_builddir)/libbb/libbb.la