5 #define MIN(x,y) ((x) > (y) ? (y) : (x))
9 int read_bmp_file(char* filename
,
19 int read_line(int fd
, char* buffer
, int buffer_size
)
26 while (count
< buffer_size
)
30 if (1 != read(fd
, &c
, 1))
44 buffer
[MIN(count
, buffer_size
- 1)] = 0;
46 return errno
? -1 : num_read
;
49 bool load_wps_backdrop(char* filename
)
54 static char pluginbuf
[PLUGIN_BUFFER_SIZE
];
56 void* plugin_get_buffer(size_t *buffer_size
)
58 *buffer_size
= PLUGIN_BUFFER_SIZE
;
62 int main(int argc
, char **argv
)
70 printf("Usage: checkwps filename.wps\n");
74 fd
= open(argv
[1], O_RDONLY
);
76 printf("Failed to open %s\n",argv
[1]);
81 res
= wps_data_load(&wps
, argv
[1], true);
84 printf("WPS parsing failure\n");
88 printf("WPS parsed OK\n");