From e22336673aca979e1e893b25b58e6d726fc739cf Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Fri, 26 Jan 2007 02:13:16 +0000 Subject: Dan McGee * Lots of code cleanup, and type fixes * Make 'makeworld' a bit more in-line with the other stuff * Make -Si and -Qi operations appear the same --- src/pacman/Makefile.am | 4 ++-- src/pacman/downloadprog.c | 6 +++--- src/pacman/package.c | 22 +++++++++++----------- src/pacman/pacman.c | 4 ++-- src/pacman/trans.h | 1 + src/pacman/util.c | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am index 0de2383e..02748628 100644 --- a/src/pacman/Makefile.am +++ b/src/pacman/Makefile.am @@ -17,9 +17,9 @@ pacman_SOURCES = util.c log.c package.c downloadprog.c trans.c add.c \ pacman_static_SOURCES = $(pacman_SOURCES) pacman_LDADD = -L$(top_srcdir)/lib/libalpm/.libs \ - -ldownload -lm -lalpm + -ldownload -lalpm pacman_static_LDADD = -L$(top_srcdir)/lib/libalpm/.libs/ \ - -ldownload -lm -lalpm + -ldownload -lalpm pacman_static_LDFLAGS = $(LDFLAGS) -all-static diff --git a/src/pacman/downloadprog.c b/src/pacman/downloadprog.c index ae9f2005..e7dc37f0 100644 --- a/src/pacman/downloadprog.c +++ b/src/pacman/downloadprog.c @@ -53,6 +53,9 @@ void log_progress(const char *filename, int xfered, int total) { static unsigned int lasthash = 0, mouth = 0; unsigned int i, hash; + /* a little hard to conceal easter eggs in open-source software, + * but they're still fun. ;) */ + const unsigned short chomp = alpm_option_get_chomp(); unsigned int chomp = 0; char *fname, *p; unsigned int maxcols = getcols(); @@ -75,9 +78,6 @@ void log_progress(const char *filename, int xfered, int total) return; } - /* a little hard to conceal easter eggs in open-source software, but they're still fun. ;) */ - chomp = alpm_option_get_chomp(); - gettimeofday(¤t_time, NULL); total_timediff = current_time.tv_sec-initial_time.tv_sec + (float)(current_time.tv_usec-initial_time.tv_usec) / 1000000; diff --git a/src/pacman/package.c b/src/pacman/package.c index fa5ae0f4..a2357dbe 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -63,24 +63,24 @@ void dump_pkg_full(pmpkg_t *pkg, int level) /* actual output */ printf(_("Name : %s\n"), (char *)alpm_pkg_get_name(pkg)); printf(_("Version : %s\n"), (char *)alpm_pkg_get_version(pkg)); - list_display(_("Groups :"), alpm_pkg_get_groups(pkg)); - printf(_("Packager : %s\n"), (char *)alpm_pkg_get_packager(pkg)); printf(_("URL : %s\n"), (char *)alpm_pkg_get_url(pkg)); list_display(_("License :"), alpm_pkg_get_licenses(pkg)); + list_display(_("Groups :"), alpm_pkg_get_groups(pkg)); + list_display(_("Provides :"), alpm_pkg_get_provides(pkg)); + list_display(_("Depends On :"), alpm_pkg_get_depends(pkg)); + list_display(_("Removes :"), alpm_pkg_get_removes(pkg)); + /* TODO only applicable if querying installed package, not a file */ + list_display(_("Required By :"), alpm_pkg_get_requiredby(pkg)); + list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); + printf(_("Installed Size : %ld K\n"), (long)alpm_pkg_get_size(pkg) / 1024); + printf(_("Packager : %s\n"), (char *)alpm_pkg_get_packager(pkg)); printf(_("Architecture : %s\n"), (char *)alpm_pkg_get_arch(pkg)); - printf(_("Installed Size : %ld\n"), (long int)alpm_pkg_get_size(pkg)); printf(_("Build Date : %s %s\n"), bdate, strlen(bdate) ? "UTC" : ""); printf(_("Build Type : %s\n"), strlen(type) ? type : _("Unknown")); /* TODO only applicable if querying installed package, not a file */ printf(_("Install Date : %s %s\n"), idate, strlen(idate) ? "UTC" : ""); printf(_("Install Script : %s\n"), alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No")); printf(_("Reason : %s\n"), reason); - list_display(_("Provides :"), alpm_pkg_get_provides(pkg)); - list_display(_("Depends On :"), alpm_pkg_get_depends(pkg)); - list_display(_("Removes :"), alpm_pkg_get_removes(pkg)); - /* TODO only applicable if querying installed package, not a file */ - list_display(_("Required By :"), alpm_pkg_get_requiredby(pkg)); - list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); printf(_("Description : ")); indentprint(alpm_pkg_get_desc(pkg), 17); @@ -117,8 +117,8 @@ void dump_pkg_sync(pmpkg_t *pkg, const char *treename) list_display(_("Removes :"), alpm_pkg_get_removes(pkg)); list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); list_display(_("Replaces :"), alpm_pkg_get_replaces(pkg)); - printf(_("Download Size : %ld\n"), (long)alpm_pkg_get_size(pkg)); - printf(_("Installed Size : %ld\n"), (long)alpm_pkg_get_isize(pkg)); + printf(_("Download Size : %6.2f K\n"), (float)alpm_pkg_get_size(pkg) / 1024.0); + printf(_("Installed Size : %6.2f K\n"), (float)alpm_pkg_get_isize(pkg) / 1024.0); printf(_("Description : ")); indentprint(alpm_pkg_get_desc(pkg), 17); diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 56dd5035..808d8ad1 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -121,8 +121,8 @@ static void usage(int op, char *myname) printf(_("usage: %s {-Q --query} [options] [package]\n"), myname); printf(_("options:\n")); printf(_(" -c, --changelog view the changelog of a package\n")); - printf(_(" -e, --orphans list all packages that were installed as a dependency\n")); - printf(_(" and are not required by any other packages\n")); + printf(_(" -e, --orphans list all packages installed as dependencies but no longer\n")); + printf(_(" required by any package\n")); printf(_(" -g, --groups view all members of a package group\n")); printf(_(" -i, --info view package information\n")); printf(_(" -l, --list list the contents of the queried package\n")); diff --git a/src/pacman/trans.h b/src/pacman/trans.h index 1e08dff6..6eb78358 100644 --- a/src/pacman/trans.h +++ b/src/pacman/trans.h @@ -28,6 +28,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2); void cb_trans_conv(pmtransconv_t event, void *data1, void *data2, void *data3, int *response); +/* callback to handle display of the progress bar for transactions */ void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent, int howmany, int remain); diff --git a/src/pacman/util.c b/src/pacman/util.c index 16f4c78a..01d0e65c 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -167,7 +167,7 @@ void indentprint(const char *str, unsigned int indent) while(*p) { if(*p == ' ') { const char *next = NULL; - int len; + unsigned int len; p++; if(p == NULL || *p == ' ') continue; next = strchr(p, ' '); -- cgit v1.2.3-54-g00ecf