summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-02-18 17:01:17 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-03 14:09:55 +0200
commitf7dce9c8c9665e63452794e51e4bea1794664a5e (patch)
tree978efe7726f34aafa952135e97cd358979d490ab /src/bin
parent4d7e908e49223f530026b5ef904a5e63d97603b7 (diff)
Eolian/Generator: update options and return value from main.
-v is used instead of -V returns 1 when an error occurred useless print removed when scanning include directories
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/main.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 3a2df701e4..49e826e8b6 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -148,8 +148,7 @@ end:
148 148
149int main(int argc, char **argv) 149int main(int argc, char **argv)
150{ 150{
151 eina_init(); 151 int ret = 1;
152 int ret = 0;
153 Eina_Bool help = EINA_FALSE, show = EINA_FALSE; 152 Eina_Bool help = EINA_FALSE, show = EINA_FALSE;
154 Eina_List *included_files = NULL, *itr; 153 Eina_List *included_files = NULL, *itr;
155 Eina_List *files4gen = NULL; 154 Eina_List *files4gen = NULL;
@@ -160,12 +159,15 @@ int main(int argc, char **argv)
160 Eina_Bool happend = EINA_FALSE; 159 Eina_Bool happend = EINA_FALSE;
161 Eina_Bool lappend = EINA_FALSE; 160 Eina_Bool lappend = EINA_FALSE;
162 161
162 eina_init();
163 eolian_init();
164
163 static struct option long_options[] = 165 static struct option long_options[] =
164 { 166 {
165 /* These options set a flag. */ 167 /* These options set a flag. */
166 {"eo1", no_argument, &eo_version, 1}, 168 {"eo1", no_argument, &eo_version, 1},
167 {"eo2", no_argument, &eo_version, 2}, 169 {"eo2", no_argument, &eo_version, 2},
168 {"verbose", no_argument, 0, 'V'}, 170 {"verbose", no_argument, 0, 'v'},
169 {"help", no_argument, 0, 'h'}, 171 {"help", no_argument, 0, 'h'},
170 {"gh", required_argument, 0, 1}, 172 {"gh", required_argument, 0, 1},
171 {"gc", required_argument, 0, 2}, 173 {"gc", required_argument, 0, 2},
@@ -177,7 +179,7 @@ int main(int argc, char **argv)
177 {0, 0, 0, 0} 179 {0, 0, 0, 0}
178 }; 180 };
179 int long_index =0, opt; 181 int long_index =0, opt;
180 while ((opt = getopt_long(argc, argv,"Vho:I:", long_options, &long_index )) != -1) 182 while ((opt = getopt_long(argc, argv,"vho:I:", long_options, &long_index )) != -1)
181 { 183 {
182 switch (opt) { 184 switch (opt) {
183 case 0: break; 185 case 0: break;
@@ -187,11 +189,10 @@ int main(int argc, char **argv)
187 case 4: leg_filename = optarg; lappend = EINA_TRUE; break; 189 case 4: leg_filename = optarg; lappend = EINA_TRUE; break;
188 case 5: eoleg_filename = optarg; break; 190 case 5: eoleg_filename = optarg; break;
189 case 6: legacy_support = EINA_TRUE; break; 191 case 6: legacy_support = EINA_TRUE; break;
190 case 'V': show = EINA_TRUE; break; 192 case 'v': show = EINA_TRUE; break;
191 case 'h': help = EINA_TRUE; break; 193 case 'h': help = EINA_TRUE; break;
192 case 'I': 194 case 'I':
193 { 195 {
194 printf("%s\n", optarg);
195 const char *dir = optarg; 196 const char *dir = optarg;
196 if (ecore_file_is_dir(dir)) 197 if (ecore_file_is_dir(dir))
197 { 198 {
@@ -220,9 +221,9 @@ int main(int argc, char **argv)
220 while (optind < argc) 221 while (optind < argc)
221 files4gen = eina_list_append(files4gen, argv[optind++]); 222 files4gen = eina_list_append(files4gen, argv[optind++]);
222 223
223 if (!included_files || help || !files4gen) 224 if (help)
224 { 225 {
225 printf("Usage: %s [-h/--help] [-V/--verbose] [-I/--include input_dir] [--legacy] [--gh|--gc|--ah filename] eo_file... \n", argv[0]); 226 printf("Usage: %s [-h/--help] [-v/--verbose] [-I/--include input_dir] [--legacy] [--gh|--gc|--ah filename] eo_file... \n", argv[0]);
226 printf(" --eo1/--eo2 Set generator to eo1/eo2 mode. Must be specified\n"); 227 printf(" --eo1/--eo2 Set generator to eo1/eo2 mode. Must be specified\n");
227 printf(" --gh Generate c header file [.h]\n"); 228 printf(" --gh Generate c header file [.h]\n");
228 printf(" --gc Generate c source file [.c]\n"); 229 printf(" --gc Generate c source file [.c]\n");
@@ -230,10 +231,16 @@ int main(int argc, char **argv)
230 printf(" --al Append legacy function definitions to an existing c header file [.h]\n"); 231 printf(" --al Append legacy function definitions to an existing c header file [.h]\n");
231 printf(" --gle Generate eo and legacy file [.h]\n"); 232 printf(" --gle Generate eo and legacy file [.h]\n");
232 printf(" --legacy Generate legacy\n"); 233 printf(" --legacy Generate legacy\n");
233 return 0; 234 ret = 0;
235 goto end;
236 }
237
238 if (!files4gen)
239 {
240 printf("No input files specified.\nTerminating.\n");
241 goto end;
234 } 242 }
235 243
236 eolian_init();
237 const char *filename; 244 const char *filename;
238 EINA_LIST_FOREACH(included_files, itr, filename) 245 EINA_LIST_FOREACH(included_files, itr, filename)
239 { 246 {
@@ -265,7 +272,6 @@ int main(int argc, char **argv)
265 if (!eo_version) 272 if (!eo_version)
266 { 273 {
267 printf("No eo version specified (use --eo1 or --eo2). Aborting eo generation.\n"); 274 printf("No eo version specified (use --eo1 or --eo2). Aborting eo generation.\n");
268 ret = 1;
269 goto end; 275 goto end;
270 } 276 }
271 277
@@ -300,6 +306,7 @@ int main(int argc, char **argv)
300 _generate_eo_and_legacy_h_file(eoleg_filename, classname); 306 _generate_eo_and_legacy_h_file(eoleg_filename, classname);
301 } 307 }
302 308
309 ret = 0;
303end: 310end:
304 EINA_LIST_FREE(included_files, filename) 311 EINA_LIST_FREE(included_files, filename)
305 free((char *)filename); 312 free((char *)filename);