| 270 char *opt_config_dir_arg = NULL; |
266 char *opt_config_dir_arg = NULL; |
| 271 gboolean debug_enabled = FALSE; |
267 gboolean debug_enabled = FALSE; |
| 272 GStatBuf st; |
268 GStatBuf st; |
| 273 |
269 |
| 274 struct option long_options[] = { |
270 struct option long_options[] = { |
| 275 {"config", required_argument, NULL, 'c'}, |
271 {"config", required_argument, NULL, 'c'}, |
| 276 {"debug", no_argument, NULL, 'd'}, |
272 {"debug", no_argument, NULL, 'd'}, |
| 277 {"help", no_argument, NULL, 'h'}, |
273 {"help", no_argument, NULL, 'h'}, |
| 278 {"nologin", no_argument, NULL, 'n'}, |
274 {"nologin", no_argument, NULL, 'n'}, |
| 279 {"version", no_argument, NULL, 'v'}, |
275 {"version", no_argument, NULL, 'v'}, |
| 280 #ifdef ENABLE_INTROSPECTION |
|
| 281 {"introspect-dump", required_argument, NULL, 'i'}, |
|
| 282 #endif |
|
| 283 {0, 0, 0, 0} |
276 {0, 0, 0, 0} |
| 284 }; |
277 }; |
| 285 |
278 |
| 286 #ifdef ENABLE_NLS |
279 #ifdef ENABLE_NLS |
| 287 bindtextdomain(PACKAGE, LOCALEDIR); |
280 bindtextdomain(PACKAGE, LOCALEDIR); |
| 293 setlocale(LC_ALL, ""); |
286 setlocale(LC_ALL, ""); |
| 294 #endif |
287 #endif |
| 295 |
288 |
| 296 /* scan command-line options */ |
289 /* scan command-line options */ |
| 297 opterr = 1; |
290 opterr = 1; |
| 298 while ((opt = getopt_long(argc, argv, "c:dhn::vi:", |
291 while ((opt = getopt_long(argc, argv, "c:dhn::v", |
| 299 long_options, NULL)) != -1) { |
292 long_options, NULL)) != -1) { |
| 300 switch (opt) { |
293 switch (opt) { |
| 301 case 'c': /* config dir */ |
294 case 'c': /* config dir */ |
| 302 g_free(opt_config_dir_arg); |
295 g_free(opt_config_dir_arg); |
| 303 opt_config_dir_arg = g_strdup(optarg); |
296 opt_config_dir_arg = g_strdup(optarg); |
| 312 opt_nologin = TRUE; |
305 opt_nologin = TRUE; |
| 313 break; |
306 break; |
| 314 case 'v': /* version */ |
307 case 'v': /* version */ |
| 315 opt_version = TRUE; |
308 opt_version = TRUE; |
| 316 break; |
309 break; |
| 317 #ifdef ENABLE_INTROSPECTION |
|
| 318 case 'i': /* introspection */ |
|
| 319 g_irepository_dump(optarg, NULL); |
|
| 320 return 0; |
|
| 321 break; |
|
| 322 #endif |
|
| 323 case '?': /* show terse help */ |
310 case '?': /* show terse help */ |
| 324 default: |
311 default: |
| 325 show_usage(argv[0], TRUE); |
312 show_usage(argv[0], TRUE); |
| 326 return 0; |
313 return 0; |
| 327 break; |
314 break; |