From b3f4bd9750821787d179340b0d1c7a5490276c10 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 6 Apr 2008 22:24:29 +1000 Subject: Quote filenames in find expression in pacdiff From 41cc28f560bf9843d81ce5fb62b884b6325d06a0 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 6 Apr 2008 22:18:06 +1000 Subject: [PATCH] Quote filenames in find expression in pacdiff Small patch to allow pacdiff to run in /etc. See FS#10090. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- contrib/pacdiff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pacdiff b/contrib/pacdiff index 19a680f1..64936491 100755 --- a/contrib/pacdiff +++ b/contrib/pacdiff @@ -20,7 +20,7 @@ # Original http://phraktured.net/config/bin/pacdiff diffprog=${DIFFPROG:-vimdiff} -for x in $(find /etc/ -name *.pacnew -o -name *.pacorig -o -name *.pacsave) +for x in $(find /etc/ -name "*.pacnew" -o -name "*.pacorig" -o -name "*.pacsave") do echo "File: ${x%.pac*}" chk="$(cmp $x ${x%.pac*})" -- cgit v1.2.3-24-g4f1b From 9441fba12430f568b8b7456fcbe54d4c8a42d24d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 7 Apr 2008 18:35:12 -0500 Subject: Add *.exe ignores for certain other platforms Signed-off-by: Dan McGee --- src/pacman/.gitignore | 1 + src/util/.gitignore | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/pacman/.gitignore b/src/pacman/.gitignore index 3b2600fd..61407057 100644 --- a/src/pacman/.gitignore +++ b/src/pacman/.gitignore @@ -1,4 +1,5 @@ .deps .libs pacman +pacman.exe pacman.static diff --git a/src/util/.gitignore b/src/util/.gitignore index 36688806..c85ea2ca 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore @@ -1,5 +1,8 @@ .deps .libs vercmp +vercmp.exe testpkg +testpkg.exe testdb +testdb.exe -- cgit v1.2.3-24-g4f1b From bec2ba5b4005053ce8f7048fa825ed58e3adfdc2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 7 Apr 2008 18:36:18 -0500 Subject: Add check for swprintf() and a workaround when it is missing We use this function once in our codebase, but fortunately the workaround is relatively easy. swprintf() is not available on Cygwin so the compile failed there, but we can do a series of mbstowcs() calls that produce the same end result as the swprintf() call. Signed-off-by: Dan McGee --- configure.ac | 4 ++-- src/pacman/callback.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6916329f..c695c57f 100644 --- a/configure.ac +++ b/configure.ac @@ -161,8 +161,8 @@ AC_FUNC_FORK AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_MKTIME AC_TYPE_SIGNAL -AC_CHECK_FUNCS([realpath regcomp strcasecmp strdup strerror strnlen \ - strndup strrchr strsep strstr strverscmp uname geteuid]) +AC_CHECK_FUNCS([geteuid realpath regcomp strcasecmp strdup strerror \ + strndup strrchr strsep strstr strverscmp swprintf uname]) # Enable large file support if available AC_SYS_LARGEFILE diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 01e65a95..a7686483 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -393,7 +393,17 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, len = strlen(opr) + ((pkgname) ? strlen(pkgname) : 0) + 2; wcstr = calloc(len, sizeof(wchar_t)); /* print our strings to the alloc'ed memory */ +#if defined(HAVE_SWPRINTF) wclen = swprintf(wcstr, len, L"%s %s", opr, pkgname); +#else + /* because the format string was simple, we can easily do this without + * using swprintf, although it is probably not as safe/fast. The max + * chars we can copy is decremented each time by subtracting the length + * of the already printed/copied wide char string. */ + wclen = mbstowcs(wcstr, opr, len); + wclen += mbstowcs(wcstr + wclen, " ", len - wclen); + wclen += mbstowcs(wcstr + wclen, pkgname, len - wclen); +#endif wcwid = wcswidth(wcstr, wclen); padwid = textlen - wcwid; /* if padwid is < 0, we need to trim the string so padwid = 0 */ -- cgit v1.2.3-24-g4f1b