5 #define MIN(x,y) ((x) > (y) ? (y) : (x))
8 int wps_verbose_level
= 0;
10 int read_bmp_file(char* filename
,
20 int read_line(int fd
, char* buffer
, int buffer_size
)
27 while (count
< buffer_size
)
31 if (1 != read(fd
, &c
, 1))
45 buffer
[MIN(count
, buffer_size
- 1)] = 0;
47 return errno
? -1 : num_read
;
50 bool load_wps_backdrop(char* filename
)
55 static char pluginbuf
[PLUGIN_BUFFER_SIZE
];
57 void* plugin_get_buffer(size_t *buffer_size
)
59 *buffer_size
= PLUGIN_BUFFER_SIZE
;
63 int main(int argc
, char **argv
)
72 printf("Usage: checkwps [OPTIONS] filename.wps\n");
73 printf("\nOPTIONS:\n");
74 printf("\t-v\tverbose\n");
75 printf("\t-vv\tmore verbose\n");
76 printf("\t-vvv\tvery verbose\n");
80 if (argv
[1][0] == '-') {
83 while (argv
[1][i
] && argv
[1][i
] == 'v') {
89 fd
= open(argv
[filearg
], O_RDONLY
);
91 printf("Failed to open %s\n",argv
[1]);
96 res
= wps_data_load(&wps
, argv
[filearg
], true);
99 printf("WPS parsing failure\n");
103 printf("WPS parsed OK\n");