summaryrefslogtreecommitdiff
path: root/tools/checkwps.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/checkwps.c')
-rw-r--r--tools/checkwps.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/checkwps.c b/tools/checkwps.c
index 74ce1e82be..950c341bfc 100644
--- a/tools/checkwps.c
+++ b/tools/checkwps.c
@@ -5,6 +5,7 @@
5#define MIN(x,y) ((x) > (y) ? (y) : (x)) 5#define MIN(x,y) ((x) > (y) ? (y) : (x))
6 6
7bool debug_wps = true; 7bool debug_wps = true;
8int wps_verbose_level = 0;
8 9
9int read_bmp_file(char* filename, 10int read_bmp_file(char* filename,
10 struct bitmap *bm, 11 struct bitmap *bm,
@@ -63,22 +64,36 @@ int main(int argc, char **argv)
63{ 64{
64 int res; 65 int res;
65 int fd; 66 int fd;
67 int filearg = 1;
66 68
67 struct wps_data wps; 69 struct wps_data wps;
68 70
69 if (argc != 2) { 71 if (argc < 2) {
70 printf("Usage: checkwps filename.wps\n"); 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");
71 return 1; 77 return 1;
72 } 78 }
73 79
74 fd = open(argv[1], O_RDONLY); 80 if (argv[1][0] == '-') {
81 filearg++;
82 int i = 1;
83 while (argv[1][i] && argv[1][i] == 'v') {
84 i++;
85 wps_verbose_level++;
86 }
87 }
88
89 fd = open(argv[filearg], O_RDONLY);
75 if (fd < 0) { 90 if (fd < 0) {
76 printf("Failed to open %s\n",argv[1]); 91 printf("Failed to open %s\n",argv[1]);
77 return 2; 92 return 2;
78 } 93 }
79 close(fd); 94 close(fd);
80 95
81 res = wps_data_load(&wps, argv[1], true); 96 res = wps_data_load(&wps, argv[filearg], true);
82 97
83 if (!res) { 98 if (!res) {
84 printf("WPS parsing failure\n"); 99 printf("WPS parsing failure\n");