From bb787e26ee01f961c76fbe4e568275a66e80009f Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Mon, 15 May 2006 02:19:57 +0000 Subject: first stage of i18n stuff from VMiklos --- lib/libalpm/util.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'lib/libalpm/util.c') diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 49580c36..f85f5ce3 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef CYGWIN #include /* PATH_MAX */ #endif @@ -223,7 +224,7 @@ int _alpm_unpack(char *archive, const char *prefix, const char *fn) while(!th_read(tar)) { if(fn && strcmp(fn, th_get_pathname(tar))) { if(TH_ISREG(tar) && tar_skip_regfile(tar)) { - _alpm_log(PM_LOG_ERROR, "bad tar archive: %s", archive); + _alpm_log(PM_LOG_ERROR, _("bad tar archive: %s"), archive); tar_close(tar); return(1); } @@ -231,7 +232,7 @@ int _alpm_unpack(char *archive, const char *prefix, const char *fn) } snprintf(expath, PATH_MAX, "%s/%s", prefix, th_get_pathname(tar)); if(tar_extract_file(tar, expath)) { - _alpm_log(PM_LOG_ERROR, "could not extract %s (%s)", th_get_pathname(tar), strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), th_get_pathname(tar), strerror(errno)); } if(fn) break; } @@ -379,7 +380,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha } snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root); if(mkdtemp(tmpdir) == NULL) { - _alpm_log(PM_LOG_ERROR, "could not create temp directory"); + _alpm_log(PM_LOG_ERROR, _("could not create temp directory")); return(1); } _alpm_unpack(installfn, tmpdir, ".INSTALL"); @@ -399,17 +400,17 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha /* save the cwd so we can restore it later */ if(getcwd(cwd, PATH_MAX) == NULL) { - _alpm_log(PM_LOG_ERROR, "could not get current working directory"); + _alpm_log(PM_LOG_ERROR, _("could not get current working directory")); /* in case of error, cwd content is undefined: so we set it to something */ cwd[0] = 0; } /* just in case our cwd was removed in the upgrade operation */ if(chdir(root) != 0) { - _alpm_log(PM_LOG_ERROR, "could not change directory to %s (%s)", root, strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)"), root, strerror(errno)); } - _alpm_log(PM_LOG_FLOW2, "executing %s script...", script); + _alpm_log(PM_LOG_FLOW2, _("executing %s script..."), script); if(oldver) { snprintf(cmdline, PATH_MAX, "source %s %s %s %s", @@ -422,28 +423,28 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha pid = fork(); if(pid == -1) { - _alpm_log(PM_LOG_ERROR, "could not fork a new process (%s)", strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("could not fork a new process (%s)"), strerror(errno)); retval = 1; goto cleanup; } if(pid == 0) { - _alpm_log(PM_LOG_DEBUG, "chrooting in %s", root); + _alpm_log(PM_LOG_DEBUG, _("chrooting in %s"), root); if(chroot(root) != 0) { - _alpm_log(PM_LOG_ERROR, "could not change the root directory (%s)", strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("could not change the root directory (%s)"), strerror(errno)); return(1); } if(chdir("/") != 0) { - _alpm_log(PM_LOG_ERROR, "could not change directory to / (%s)", strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("could not change directory to / (%s)"), strerror(errno)); return(1); } umask(0022); - _alpm_log(PM_LOG_DEBUG, "executing \"%s\"", cmdline); + _alpm_log(PM_LOG_DEBUG, _("executing \"%s\""), cmdline); execl("/bin/sh", "sh", "-c", cmdline, (char *)0); exit(0); } else { if(waitpid(pid, 0, 0) == -1) { - _alpm_log(PM_LOG_ERROR, "call to waitpid failed (%s)", strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"), strerror(errno)); retval = 1; goto cleanup; } @@ -451,7 +452,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha cleanup: if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) { - _alpm_log(PM_LOG_WARNING, "could not remove tmpdir %s", tmpdir); + _alpm_log(PM_LOG_WARNING, _("could not remove tmpdir %s"), tmpdir); } if(strlen(cwd)) { chdir(cwd); -- cgit v1.2.3-2-g168b