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