aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-11-08 13:47:43 +0000
committerJustus Winter <[email protected]>2016-11-08 15:02:55 +0000
commitd4454837cd60981c2863955b11c9e1cc8f9e3833 (patch)
tree6bff5b90c281be05c20d7267b5e6dd27d3d3d2fa
parenttests,w32: Make cleanup more robust. (diff)
downloadgnupg-d4454837cd60981c2863955b11c9e1cc8f9e3833.tar.gz
gnupg-d4454837cd60981c2863955b11c9e1cc8f9e3833.zip
gpgscm: Fix error message.
* tests/gpgscm/ffi.c (do_wait_processes): Fix and improve error messages. Signed-off-by: Justus Winter <[email protected]>
-rw-r--r--tests/gpgscm/ffi.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index d4bf3ef07..add82f700 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -48,6 +48,20 @@
#include "ffi.h"
#include "ffi-private.h"
+/* For use in nice error messages. */
+static const char *
+ordinal_suffix (int n)
+{
+ switch (n)
+ {
+ case 1: return "st";
+ case 2: return "nd";
+ case 3: return "rd";
+ default: return "th";
+ }
+ assert (! "reached");
+}
+
int
@@ -827,17 +841,19 @@ do_wait_processes (scheme *sc, pointer args)
err = ffi_list2argv (sc, list_names, &names, &count);
if (err == gpg_error (GPG_ERR_INV_VALUE))
- return ffi_sprintf (sc, "%luth element of first argument is "
+ return ffi_sprintf (sc, "%lu%s element of first argument is "
"neither string nor symbol",
- (unsigned long) count);
+ (unsigned long) count,
+ ordinal_suffix ((int) count));
if (err)
FFI_RETURN_ERR (sc, err);
err = ffi_list2intv (sc, list_pids, (int **) &pids, &count);
if (err == gpg_error (GPG_ERR_INV_VALUE))
- return ffi_sprintf (sc, "%luth element of second argument is "
- "neither string nor symbol",
- (unsigned long) count);
+ return ffi_sprintf (sc, "%lu%s element of second argument is "
+ "not a number",
+ (unsigned long) count,
+ ordinal_suffix ((int) count));
if (err)
FFI_RETURN_ERR (sc, err);
@@ -995,19 +1011,6 @@ do_file_equal (scheme *sc, pointer args)
goto out;
}
-static const char *
-ordinal_suffix (int n)
-{
- switch (n)
- {
- case 1: return "st";
- case 2: return "nd";
- case 3: return "rd";
- default: return "th";
- }
- assert (! "reached");
-}
-
static pointer
do_splice (scheme *sc, pointer args)
{