removed stat() call in lp_add_home()
[Samba.git] / source / aparser / vluke.c
blobd3868f2753eb7e1d5833ead8782860d1dcabf917
1 #include "parser.h"
2 #include "test.h"
4 int main(int argc, char *argv[])
6 BOOL ret;
7 char *fname, *test;
8 int fd;
9 struct stat st;
10 io_struct ps;
12 if (argc < 3) {
13 printf("usage: vluke <structure> <file>\n");
14 exit(1);
17 test = argv[1];
18 fname = argv[2];
20 fd = open(fname,O_RDONLY);
21 if (fd == -1) {
22 perror(fname);
23 exit(1);
25 fstat(fd, &st);
27 io_init(&ps, 0, MARSHALL);
28 ps.is_dynamic=True;
29 io_read(&ps, fd, st.st_size, 0);
30 ps.data_offset = 0;
31 ps.buffer_size = ps.grow_size;
32 ps.io = UNMARSHALL;
33 ps.autoalign = OPTION_autoalign;
34 ret = run_test(test, &ps, PARSE_SCALARS|PARSE_BUFFERS);
35 printf("\nret=%s\n", ret?"OK":"Bad");
36 printf("Trailer is %d bytes\n\n", ps.grow_size - ps.data_offset);
37 if (ps.grow_size - ps.data_offset > 0) {
38 dump_data(0, ps.data_p + ps.data_offset, ps.grow_size - ps.data_offset);
40 return !ret;