-
Notifications
You must be signed in to change notification settings - Fork 2
/
vmtest.c
43 lines (37 loc) · 843 Bytes
/
vmtest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* SVM Test
* by Takuo Watanabe
*/
#include <stdio.h>
#include <stdlib.h>
#include "vm.h"
void vmtest (int, vm_mode_t);
int main (int argc, char *argv[]) {
vm_mode_t mode = vm_normal_mode;
int n = 0;
int i = 1;
while (i < argc && argv[i][0] == '-') {
char *arg = argv[i];
int j = 1;
while (arg[j] != '\0') {
switch (arg[j]) {
case 't':
mode = vm_trace_mode;
break;
case 's':
mode = vm_step_mode;
break;
default:
fprintf(stderr, "usage: %s [-t][-s] [n]\n", argv[0]);
return EXIT_FAILURE;
}
j++;
}
i++;
}
if (i < argc) {
n = atoi(argv[i]);
}
vmtest(n, mode);
return EXIT_SUCCESS;
}