diff options
author | Stefano Esposito <stefano.esposito87@gmail.com> | 2007-09-08 18:41:45 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-09-12 03:58:27 +0200 |
commit | 27acdc2c94de558103eb29260c179a49c9b05c14 (patch) | |
tree | 969d73111d6a1943975fae23ac5ba5747bb6e0d2 /src/pacman/pacman.c | |
parent | f21c45c0ddf195a4dcfca08c19bfa23d1c7fb326 (diff) | |
download | pacman-27acdc2c94de558103eb29260c179a49c9b05c14.tar.gz pacman-27acdc2c94de558103eb29260c179a49c9b05c14.tar.xz |
make alpm_strerror binding friendly
I'm currently working on python bindings for alpm written in pyrex. While
working i found that declaring alpm_strerror as
char * alpm_strerror (void)
instead of
char * alpm_strerror (int err)
and then using pm_errno in the implementation instead of err, could make it
more bindings-friendly.
Dan: cleaned up and added void to declaration. Instead of replacing existing
function, add a new function called 'alpm_strerrorlast(void)'.
Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/pacman.c')
-rw-r--r-- | src/pacman/pacman.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index f62e588b..138389fa 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -215,7 +215,7 @@ static void cleanup(int signum) /* free alpm library resources */ if(alpm_release() == -1) { - pm_printf(PM_LOG_ERROR, alpm_strerror(pm_errno)); + pm_printf(PM_LOG_ERROR, alpm_strerrorlast()); } /* free memory */ @@ -331,7 +331,7 @@ static int parseargs(int argc, char *argv[]) case 1007: if(alpm_option_add_cachedir(optarg) != 0) { pm_printf(PM_LOG_ERROR, _("problem adding cachedir '%s' (%s)\n"), - optarg, alpm_strerror(pm_errno)); + optarg, alpm_strerrorlast()); return(1); } break; @@ -355,7 +355,7 @@ static int parseargs(int argc, char *argv[]) case 'b': if(alpm_option_set_dbpath(optarg) != 0) { pm_printf(PM_LOG_ERROR, _("problem setting dbpath '%s' (%s)\n"), - optarg, alpm_strerror(pm_errno)); + optarg, alpm_strerrorlast()); return(1); } config->have_dbpath = 1; @@ -389,7 +389,7 @@ static int parseargs(int argc, char *argv[]) case 'r': if(alpm_option_set_root(optarg) != 0) { pm_printf(PM_LOG_ERROR, _("problem setting root '%s' (%s)\n"), - optarg, alpm_strerror(pm_errno)); + optarg, alpm_strerrorlast()); return(1); } config->have_root = 1; @@ -614,7 +614,7 @@ static int _parseconfig(const char *file, const char *givensection, if(!config->have_dbpath) { if(alpm_option_set_dbpath(ptr) != 0) { pm_printf(PM_LOG_ERROR, _("problem setting dbpath '%s' (%s)\n"), - ptr, alpm_strerror(pm_errno)); + ptr, alpm_strerrorlast()); return(1); } pm_printf(PM_LOG_DEBUG, "config: dbpath: %s\n", ptr); @@ -622,7 +622,7 @@ static int _parseconfig(const char *file, const char *givensection, } else if(strcmp(key, "CacheDir") == 0 || strcmp(upperkey, "CACHEDIR") == 0) { if(alpm_option_add_cachedir(ptr) != 0) { pm_printf(PM_LOG_ERROR, _("problem adding cachedir '%s' (%s)\n"), - ptr, alpm_strerror(pm_errno)); + ptr, alpm_strerrorlast()); return(1); } pm_printf(PM_LOG_DEBUG, "config: cachedir: %s\n", ptr); @@ -631,7 +631,7 @@ static int _parseconfig(const char *file, const char *givensection, if(!config->have_root) { if(alpm_option_set_root(ptr) != 0) { pm_printf(PM_LOG_ERROR, _("problem setting root '%s' (%s)\n"), - ptr, alpm_strerror(pm_errno)); + ptr, alpm_strerrorlast()); return(1); } pm_printf(PM_LOG_DEBUG, "config: rootdir: %s\n", ptr); @@ -640,7 +640,7 @@ static int _parseconfig(const char *file, const char *givensection, if(!config->have_logfile) { if(alpm_option_set_logfile(ptr) != 0) { pm_printf(PM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"), - ptr, alpm_strerror(pm_errno)); + ptr, alpm_strerrorlast()); return(1); } pm_printf(PM_LOG_DEBUG, "config: logfile: %s\n", ptr); @@ -736,7 +736,7 @@ int main(int argc, char *argv[]) /* initialize library */ if(alpm_initialize() == -1) { pm_printf(PM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"), - alpm_strerror(pm_errno)); + alpm_strerrorlast()); cleanup(EXIT_FAILURE); } @@ -812,7 +812,7 @@ int main(int argc, char *argv[]) db_local = alpm_db_register_local(); if(db_local == NULL) { pm_printf(PM_LOG_ERROR, _("could not register 'local' database (%s)\n"), - alpm_strerror(pm_errno)); + alpm_strerrorlast()); cleanup(EXIT_FAILURE); } |