Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / commands / swifi / systest.c
blob6c41262ab6370a35a757fadc738c2f03525ec716
1 /*
2 * systest.c -- Test code for nooks system calls
4 * Copyright (C) 2002 Mike Swift
6 * The source code in this file can be freely used, adapted,
7 * and redistributed in source or binary form, so long as an
8 * acknowledgment appears in derived source files.
9 * No warranty is attached;
10 * we cannot take responsibility for errors or fitness for use.
14 #include <sys/types.h>
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <string.h>
18 #include <errno.h>
20 #include "swifi.h"
21 #include "extra.h"
23 void
24 usage(char *name)
26 printf("Usage: %s -f module_name pid fault-type fault-count seed\n", name);
28 exit(EXIT_FAILURE);
31 int
32 main(int argc, char * argv[])
34 char * module_name = NULL;
35 int i;
36 unsigned int cmd = 0;
37 unsigned long arg = 0;
38 unsigned long seed = 157;
40 if (argc < 2) {
41 usage(argv[0]);
44 for (i = 1; i < argc; i++ ) {
45 if (strcmp(argv[i], "-f") == 0) {
46 if (argc <= i+5) {
47 usage(argv[0]);
49 module_name = victim_exe = argv[++i];
50 sscanf(argv[++i],"%u", &victim_pid);
51 sscanf(argv[++i],"%u", &cmd);
52 sscanf(argv[++i],"%lu", &arg);
53 sscanf(argv[++i],"%lu", &seed);
54 } else {
55 printf("Unknown command %s\n", argv[i]);
56 usage(argv[0]);
60 /* Do the injection. */
61 swifi_inject_fault(module_name,
62 cmd, /* fault type */
63 seed, /* random seed */
64 arg); /* numFaults */
66 return EXIT_SUCCESS;