summaryrefslogtreecommitdiffstats
path: root/tools/regression/doat
diff options
context:
space:
mode:
authorbrucec <brucec@FreeBSD.org>2011-03-12 14:47:54 +0000
committerbrucec <brucec@FreeBSD.org>2011-03-12 14:47:54 +0000
commite3ccdf9a91cfbd4bd32ac050106dbaa9e22c3fe3 (patch)
tree53d79ae5495e5e16c6481e8dff338bb4cefe3a77 /tools/regression/doat
parent36a5b1834f2b1e793dd9713af5e5ea9128dcf34f (diff)
downloadFreeBSD-src-e3ccdf9a91cfbd4bd32ac050106dbaa9e22c3fe3.zip
FreeBSD-src-e3ccdf9a91cfbd4bd32ac050106dbaa9e22c3fe3.tar.gz
Fix warnings and style(9) issues.
Set WARNS to 6.
Diffstat (limited to 'tools/regression/doat')
-rw-r--r--tools/regression/doat/Makefile1
-rw-r--r--tools/regression/doat/doat.c59
2 files changed, 33 insertions, 27 deletions
diff --git a/tools/regression/doat/Makefile b/tools/regression/doat/Makefile
index be9590d..705a44d 100644
--- a/tools/regression/doat/Makefile
+++ b/tools/regression/doat/Makefile
@@ -3,5 +3,6 @@
PROG= doat
NO_MAN=
+WARNS?=6
.include <bsd.prog.mk>
diff --git a/tools/regression/doat/doat.c b/tools/regression/doat/doat.c
index 45b8206..f5ac795 100644
--- a/tools/regression/doat/doat.c
+++ b/tools/regression/doat/doat.c
@@ -26,25 +26,31 @@
* $FreeBSD$
*/
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
+
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <sys/stat.h>
+#include <unistd.h>
+
+void cleanup(void);
+void setup(void);
+void setup_once(void);
union param {
int i;
- char *cp;
+ const char *cp;
mode_t m;
dev_t d;
void *vp;
uid_t u;
gid_t g;
- char **cpp;
+ const char **cpp;
};
struct testcase {
@@ -55,7 +61,7 @@ struct testcase {
struct test {
int syscall;
int num_of_cases;
- char *name;
+ const char *name;
struct testcase tests[10]; /* no more than 10 tests */
};
@@ -64,21 +70,21 @@ struct test *tests;
#define NUM_OF_TESTS 14 /* we dont want the fexecve test to run */
char *absolute_path = NULL;
-char *relative_path = "tmp/";
-char *not_dir_path = "/bin/date";
+const char *relative_path = "tmp/";
+const char *not_dir_path = "/bin/date";
-char *file = "foo";
+const char *file = "foo";
char *absolute_file = NULL;
char *relative_file = NULL;
-char *symlinkf = "link";
-char *newlink = "nlink1";
-char *newlink2 = "nlink2";
-char *newlink3 = "nlink3";
-char *newdir = "newdir";
-char *fifo = "fifo";
-char *nod = "nod";
-char *newfile = "newfile";
-char *newslink = "nslink1";
+const char *symlinkf = "link";
+const char *newlink = "nlink1";
+const char *newlink2 = "nlink2";
+const char *newlink3 = "nlink3";
+const char *newdir = "newdir";
+const char *fifo = "fifo";
+const char *nod = "nod";
+const char *newfile = "newfile";
+const char *newslink = "nslink1";
bool dir_exist = false;
bool file_exist = false;
@@ -88,15 +94,14 @@ int rel_fd, abs_fd, notd_fd, exec_fd;
struct timeval times[2];
struct stat buf;
-char *pargv[2] = { "/bin/date", NULL };
+const char *pargv[2] = { "/bin/date", NULL };
#define PATH_MAX 1024
char cbuf[PATH_MAX];
void
-setup()
+setup(void)
{
int i, error;
- size_t siz;
struct stat sb;
tests = calloc(NUM_OF_TESTS, sizeof(struct test));
@@ -607,13 +612,13 @@ setup()
}
void
-cleanup()
+cleanup(void)
{
system("/bin/sh -c 'rm -rf tmp'");
}
void
-setup_once()
+setup_once(void)
{
}
@@ -623,10 +628,13 @@ main(int argc, char *argv[])
int i,j;
int error;
+ (void)argc;
+ (void)argv;
+
setup();
for (i = 0; i < NUM_OF_TESTS; i++) {
- printf("\nTest: %s\n", tests[i].name);
+ printf("\nTest: %s\n", tests[i].name);
for (j = 0; j < tests[i].num_of_cases; j++) {
error = syscall(tests[i].syscall,
tests[i].tests[j].params[0],
@@ -652,13 +660,10 @@ main(int argc, char *argv[])
printf("#%i ... OK\n", j);
}
}
-
-
}
}
cleanup();
-
return (0);
}
OpenPOWER on IntegriCloud