regex.m4: correct the reversed range endpoint ([b-a]) test
[gnulib.git] / tests / test-symlinkat.c
index 4a6fe0a..c3dec29 100644 (file)
@@ -1,5 +1,5 @@
 /* Tests of symlinkat and readlinkat.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <unistd.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (symlinkat, int, (char const *, int, char const *));
+SIGNATURE_CHECK (readlinkat, ssize_t, (int, char const *, char *, size_t));
+
 #include <fcntl.h>
 #include <errno.h>
 #include <stdbool.h>
 #include <string.h>
 #include <sys/stat.h>
 
+#include "ignore-value.h"
+#include "macros.h"
+
 #ifndef HAVE_SYMLINK
 # define HAVE_SYMLINK 0
 #endif
 
-#define ASSERT(expr) \
-  do                                                                         \
-    {                                                                        \
-      if (!(expr))                                                           \
-       {                                                                    \
-         fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__);  \
-         fflush (stderr);                                                   \
-         abort ();                                                          \
-       }                                                                    \
-    }                                                                        \
-  while (0)
-
 #define BASE "test-symlinkat.t"
 
 #include "test-readlink.h"
@@ -64,13 +59,13 @@ do_readlink (char const *name, char *buf, size_t len)
 }
 
 int
-main ()
+main (void)
 {
   char buf[80];
   int result;
 
   /* Remove any leftovers from a previous partial run.  */
-  ASSERT (system ("rm -rf " BASE "*") == 0);
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Perform same checks as counterpart functions.  */
   result = test_readlink (do_readlink, false);
@@ -117,7 +112,7 @@ main ()
 
   ASSERT (close (dfd) == 0);
   if (result == 77)
-    fputs ("skipping test: symlinks not supported on this filesystem\n",
-          stderr);
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
   return result;
 }