summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-11-02 02:29:10 +0000
committerAaron Griffin <aaron@archlinux.org>2006-11-02 02:29:10 +0000
commitfbf1aa653984be4a15714a0efe3acf756daf2d57 (patch)
treeda4f9d026482393f281c627e30e95a740fa48398 /src/pacman
parent22ce4a2a006d652219e688c6f082a65366051f71 (diff)
* Fixed some alpm_get_option calls (long params were used for C99 compliance,
but were used in error) * Cleaned up some output newlines * Added "local database is up to date" when no packages are upgraded
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/log.c3
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/pacman.c4
-rw-r--r--src/pacman/query.c9
-rw-r--r--src/pacman/sync.c10
-rw-r--r--src/pacman/trans.c28
6 files changed, 27 insertions, 29 deletions
diff --git a/src/pacman/log.c b/src/pacman/log.c
index 01a9a143..17d6965a 100644
--- a/src/pacman/log.c
+++ b/src/pacman/log.c
@@ -164,6 +164,9 @@ int yesno(char *fmt, ...)
*++pch = 0;
strtrim(response);
+ /* User hits 'enter', forcing a newline here */
+ neednl = 0;
+
if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || !strlen(response)) {
return(1);
}
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 0a069055..ade6f5dc 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -91,7 +91,7 @@ void dump_pkg_full(PM_PKG *pkg, int level)
long lroot;
char *root;
alpm_get_option(PM_OPT_ROOT, &lroot);
- root = (void *)&root;
+ root = (void *)lroot;
fprintf(stdout, "\n");
for(i = alpm_list_first(alpm_pkg_getinfo(pkg, PM_PKG_BACKUP)); i; i = alpm_list_next(i)) {
struct stat buf;
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index a6072a22..d35c8be0 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -543,10 +543,10 @@ int main(int argc, char *argv[])
FREE(config->dbpath);
long ldbpath, lcachedir;
alpm_get_option(PM_OPT_DBPATH, &ldbpath);
- config->dbpath = (void *)&ldbpath;
+ config->dbpath = (char *)ldbpath;
FREE(config->cachedir);
alpm_get_option(PM_OPT_CACHEDIR, &lcachedir);
- config->cachedir = (void *)&lcachedir;
+ config->cachedir = (char *)lcachedir;
for(lp = config->op_s_ignore; lp; lp = lp->next) {
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) {
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 48d4cde5..1736a935 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -63,7 +63,7 @@ static int query_fileowner(PM_DB *db, char *filename)
}
alpm_get_option(PM_OPT_ROOT, &lroot);
- root = (void *)&lroot;
+ root = (char *)lroot;
for(lp = alpm_db_getpkgcache(db); lp && !gotcha; lp = alpm_list_next(lp)) {
PM_PKG *info;
@@ -74,9 +74,10 @@ static int query_fileowner(PM_DB *db, char *filename)
for(i = alpm_pkg_getinfo(info, PM_PKG_FILES); i && !gotcha; i = alpm_list_next(i)) {
char path[PATH_MAX];
- snprintf(path, PATH_MAX, "%s%s", root, (char *)alpm_list_getdata(i));
+ char *filename = (char *)alpm_list_getdata(i);
+ snprintf(path, PATH_MAX, "%s%s", root, filename);
if(!strcmp(path, rpath)) {
- printf(_("%s is owned by %s %s\n"), filename, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
+ printf(_("%s is owned by %s %s\n"), path, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(info, PM_PKG_VERSION));
gotcha = 1;
break;
@@ -266,7 +267,7 @@ int pacman_query(list_t *targets)
long ldbpath;
char *dbpath;
alpm_get_option(PM_OPT_DBPATH, &ldbpath);
- dbpath = (void *)&ldbpath;
+ dbpath = (char *)ldbpath;
snprintf(changelog, PATH_MAX, "%s%s/%s/%s-%s/changelog",
config->root, dbpath,
(char*)alpm_db_getinfo(db_local, PM_DB_TREENAME),
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 012a7604..1d1ea29d 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -173,13 +173,18 @@ static int sync_synctree(int level, list_t *syncs)
} else {
ERR(NL, _("failed to update %s (%s)\n"), sync->treename, alpm_strerror(pm_errno));
}
- success--;
} else if(ret == 1) {
MSG(NL, _(" %s is up to date\n"), sync->treename);
+ } else {
+ success++;
}
}
- return(success);
+ /* We should always succeed if at least one DB was upgraded - we may possibly
+ * fail later with unresolved deps, but that should be rare, and would be
+ * expected
+ */
+ return(success > 0);
}
static int sync_search(list_t *syncs, list_t *targets)
@@ -569,6 +574,7 @@ int pacman_sync(list_t *targets)
packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
if(packages == NULL) {
/* nothing to do: just exit without complaining */
+ MSG(NL," local database is up to date");
goto cleanup;
}
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index ee4c79a5..ce032dc4 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -70,8 +70,6 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
case PM_TRANS_EVT_FILECONFLICTS_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
- } else {
- MSG(NL, "");
}
break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
@@ -80,8 +78,8 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
pm_fprintf(stderr, CL, _("done.\n"));
break;
case PM_TRANS_EVT_EXTRACT_DONE:
- if(!config->noprogressbar) {
- MSG(NL, "");
+ if(config->noprogressbar) {
+ MSG(CL, _("done.\n"));
}
break;
case PM_TRANS_EVT_ADD_START:
@@ -106,8 +104,6 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
case PM_TRANS_EVT_REMOVE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
- } else {
- MSG(NL, "");
}
snprintf(str, LOG_STR_LEN, _("removed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
@@ -153,7 +149,7 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
MSG(NL, "%s%s\n", (char*)data1, (char*)data2);
break;
case PM_TRANS_EVT_RETRIEVE_START:
- MSG(NL, _("\n:: Retrieving packages from %s...\n"), (char*)data1);
+ MSG(NL, _(":: Retrieving packages from %s...\n"), (char*)data1);
fflush(stdout);
break;
case PM_TRANS_EVT_RETRIEVE_LOCAL:
@@ -292,11 +288,7 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
int i, hash;
long chomp = 0;
unsigned int maxpkglen, progresslen = maxcols - 57;
- char *addstr, *upgstr, *removestr, *conflictstr, *ptr = NULL;
- addstr = strdup(_("installing"));
- upgstr = strdup(_("upgrading"));
- removestr = strdup(_("removing"));
- conflictstr = strdup(_("checking for file conflicts"));
+ char *ptr = NULL;
if(config->noprogressbar) {
return;
@@ -312,19 +304,19 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
prevpercent=percent;
switch (event) {
case PM_TRANS_PROGRESS_ADD_START:
- ptr = addstr;
+ ptr = _("installing");
break;
case PM_TRANS_PROGRESS_UPGRADE_START:
- ptr = upgstr;
+ ptr = _("upgrading");
break;
case PM_TRANS_PROGRESS_REMOVE_START:
- ptr = removestr;
+ ptr = _("removing");
break;
case PM_TRANS_PROGRESS_CONFLICTS_START:
- ptr = conflictstr;
+ ptr = _("checking for file conflicts");
break;
}
hash=percent*progresslen/100;
@@ -399,10 +391,6 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
if(percent == 100) {
printf("\n");
}
-
- FREE(addstr);
- FREE(upgstr);
- FREE(removestr);
}
/* vim: set ts=2 sw=2 noet: */