diff --git a/bin/xbps-install/Makefile b/bin/xbps-install/Makefile index 49f06ed3..2732aa06 100644 --- a/bin/xbps-install/Makefile +++ b/bin/xbps-install/Makefile @@ -2,8 +2,7 @@ TOPDIR = ../.. -include $(TOPDIR)/config.mk BIN = xbps-install -OBJS = main.o transaction.o main.o question.o fetch_cb.o state_cb.o -OBJS += unpack_cb.o util.o +OBJS = main.o transaction.o main.o question.o fetch_cb.o state_cb.o util.o MAN = $(BIN).8 include $(TOPDIR)/mk/prog.mk diff --git a/bin/xbps-install/defs.h b/bin/xbps-install/defs.h index 40c4cc23..5559b300 100644 --- a/bin/xbps-install/defs.h +++ b/bin/xbps-install/defs.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Juan Romero Pardines. + * Copyright (c) 2009-2013 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,10 +50,6 @@ void fetch_file_progress_cb(struct xbps_fetch_cb_data *, void *); /* from state_cb.c */ void state_cb(struct xbps_state_cb_data *, void *); -/* from unpack_cb.c */ -void unpack_progress_cb_verbose(struct xbps_unpack_cb_data *, void *); -void unpack_progress_cb(struct xbps_unpack_cb_data *, void *); - /* From util.c */ void print_package_line(const char *, size_t, bool); size_t get_maxcols(void); diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c index 47ba32df..2c4d490c 100644 --- a/bin/xbps-install/main.c +++ b/bin/xbps-install/main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2012 Juan Romero Pardines. + * Copyright (c) 2008-2013 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,6 +62,20 @@ usage(bool fail) exit(fail ? EXIT_FAILURE : EXIT_SUCCESS); } +static void +unpack_progress_cb(struct xbps_unpack_cb_data *xpd, void *cbdata) +{ + (void)cbdata; + + if (xpd->entry == NULL || xpd->entry_total_count <= 0) + return; + + printf("%s: unpacked %sfile `%s' (%" PRIi64 " bytes)\n", + xpd->pkgver, + xpd->entry_is_conf ? "configuration " : "", xpd->entry, + xpd->entry_size); +} + int main(int argc, char **argv) { @@ -163,7 +177,7 @@ main(int argc, char **argv) xh.flags = flags; xh.repository = defrepo; if (flags & XBPS_FLAG_VERBOSE) - xh.unpack_cb = unpack_progress_cb_verbose; + xh.unpack_cb = unpack_progress_cb; if ((rv = xbps_init(&xh)) != 0) { xbps_error_printf("Failed to initialize libxbps: %s\n", diff --git a/bin/xbps-install/unpack_cb.c b/bin/xbps-install/unpack_cb.c deleted file mode 100644 index db470178..00000000 --- a/bin/xbps-install/unpack_cb.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2008-2011 Juan Romero Pardines. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include - -#include "defs.h" - -void -unpack_progress_cb_verbose(struct xbps_unpack_cb_data *xpd, void *cbdata) -{ - (void)cbdata; - - if (xpd->entry == NULL || xpd->entry_total_count <= 0) - return; - - printf("%s: unpacked %sfile `%s' (%" PRIi64 " bytes)\n", - xpd->pkgver, - xpd->entry_is_conf ? "configuration " : "", xpd->entry, - xpd->entry_size); -} - -void -unpack_progress_cb(struct xbps_unpack_cb_data *xpd, void *cbdata) -{ - (void)cbdata; - - if (xpd->entry_total_count <= 0) - return; - - printf("%s: unpacked %zd of %zd files...\n", - xpd->pkgver, xpd->entry_extract_count, xpd->entry_total_count); - printf("\033[1A\033[K"); -}