summaryrefslogtreecommitdiff
path: root/src/bin/main.c
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-07-17 16:58:46 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-07-21 12:17:01 +0300
commitbee602ba76ea063a1e5ad4e3f1885c1a5c9ff167 (patch)
treec490d908e6dfeca98f3862938ad25837550d3c3a /src/bin/main.c
parent2c8a778e4f878f4d99a17c9efd5b96e1b70ca9ac (diff)
egui options: forbid usage of -e and --json at the same time
Diffstat (limited to 'src/bin/main.c')
-rw-r--r--src/bin/main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index af71a19..22872c1 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -104,8 +104,9 @@ _help()
104 " -s - simulate\n" 104 " -s - simulate\n"
105 " -e - export format. (-e c)\n" 105 " -e - export format. (-e c)\n"
106 " --json - generate JSON descriptions\n" 106 " --json - generate JSON descriptions\n"
107 " - if both: \"-e c --json\" are used, NAME.c and NAME.h files will be generated with JSON descriptions in it.\n" 107 " - if \"-e c --json\" is used, NAME.c and NAME.h files will be generated with JSON descriptions in it;\n"
108 " - if only: \"--json\" is used, NAME.json JSON description file will be generated.\n" 108 " - if \"--json\" is used, NAME file with JSON description will be generated;\n"
109 " \"-e\" and \"--json\" can not be used together."
109 " -o NAME in generate mode\n" 110 " -o NAME in generate mode\n"
110 " -h print this help\n"); 111 " -h print this help\n");
111} 112}
@@ -166,6 +167,11 @@ main(int argc, char **argv)
166 mode = "-e"; 167 mode = "-e";
167 i++; 168 i++;
168 const char* format = argv[i]; 169 const char* format = argv[i];
170 if (export_mode != GENERATE_NONE)
171 {
172 mode = "-h";
173 break;
174 }
169 export_mode = export_mode | GENERATE_CODE; 175 export_mode = export_mode | GENERATE_CODE;
170 if (!strcmp(format, "cpp")) 176 if (!strcmp(format, "cpp"))
171 { 177 {
@@ -193,6 +199,11 @@ main(int argc, char **argv)
193 } 199 }
194 else if (!strcmp(argv[i], "--json")) 200 else if (!strcmp(argv[i], "--json"))
195 { 201 {
202 if (export_mode != GENERATE_NONE)
203 {
204 mode = "-h";
205 break;
206 }
196 mode = "-e"; 207 mode = "-e";
197 export_mode = export_mode | GENERATE_JSON; 208 export_mode = export_mode | GENERATE_JSON;
198 } 209 }