aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
{