- clist_init(&conf_entries);
- postpone_commit = 1;
-
- static int other_options = 0;
- while (1) {
- int res = getopt_long (argc, argv, short_opts, long_opts, long_index);
- if (res == 'S' || res == 'C' || res == 0x64436667)
- {
- if (other_options)
- die("The -S and -C options must precede all other arguments");
- if (res == 'S') {
- load_default();
- if (cf_set(optarg))
- die("Cannot set %s", optarg);
- } else if (res == 'C') {
- if (cf_load(optarg))
- die("Cannot load config file %s", optarg);
- }
-#ifdef CONFIG_DEBUG
- else { /* --dumpconfig */
- load_default();
- final_commit();
- struct fastbuf *b = bfdopen(1, 4096);
- cf_dump_sections(b);
- bclose(b);
- exit(0);
- }
-#endif
- } else {
- /* unhandled option or end of options */
- if (res != ':' && res != '?')
- load_default();
- final_commit();
- other_options++;
- return res;
- }
- }
+ struct cf_context *cc = cf_get_context();
+ ASSERT(cc->postpone_commit);
+ if (!--cc->postpone_commit)
+ return maybe_commit(cc);
+ else
+ return 0;