int parse_mount(struct autofs_point *ap, const char *name, int name_len, const char *mapent, void *context) { char source[HESIOD_LEN + 1]; char fstype[HESIOD_LEN + 1]; char options[HESIOD_LEN + 1]; char *q; const char *p; int ret; ap->entry->current = NULL; master_source_current_signal(ap->entry); p = mapent; q = fstype; /* Skip any initial whitespace... */ while (isspace(*p)) p++; /* Isolate the filesystem type... */ while (!isspace(*p)) { *q++ = tolower(*p++); } *q = 0; /* If it's an error message... */ if (!strcasecmp(fstype, "err")) { error(ap->logopt, MODPREFIX "%s", mapent); return 1; /* If it's an AFS fs... */ } else if (!strcasecmp(fstype, "afs")) ret = parse_afs(ap, mapent, name, name_len, source, sizeof(source), options, sizeof(options)); /* If it's NFS... */ else if (!strcasecmp(fstype, "nfs")) ret = parse_nfs(ap, mapent, name, name_len, source, sizeof(source), options, sizeof(options)); /* Punt. */ else ret = parse_generic(ap, mapent, name, name_len, source, sizeof(source), options, sizeof(options)); if (ret) { error(ap->logopt, MODPREFIX "failed to parse entry"); return 1; } else { debug(ap->logopt, MODPREFIX "mount %s is type %s from %s", name, fstype, source); } return do_mount(ap, ap->path, name, name_len, source, fstype, options); }
static int elaborate(int argc, char **argv) { static struct option long_options[] = { { "disable-opt", no_argument, 0, 'o' }, { "dump-llvm", no_argument, 0, 'd' }, { "dump-vcode", optional_argument, 0, 'v' }, { "native", no_argument, 0, 'n' }, { "cover", no_argument, 0, 'c' }, { "verbose", no_argument, 0, 'V' }, { 0, 0, 0, 0 } }; const int next_cmd = scan_cmd(2, argc, argv); bool verbose = false; int c, index = 0; const char *spec = "Vg:"; while ((c = getopt_long(next_cmd, argv, spec, long_options, &index)) != -1) { switch (c) { case 'o': opt_set_int("optimise", 0); break; case 'd': opt_set_int("dump-llvm", 1); break; case 'v': opt_set_str("dump-vcode", optarg ?: ""); break; case 'n': opt_set_int("native", 1); break; case 'c': opt_set_int("cover", 1); break; case 'V': verbose = true; opt_set_int("verbose", 1); break; case 'g': parse_generic(optarg); break; case 0: // Set a flag break; case '?': fatal("unrecognised elaborate option %s", argv[optind - 1]); default: abort(); } } set_top_level(argv, next_cmd); elab_verbose(verbose, "initialising"); tree_t unit = lib_get(lib_work(), top_level); if (unit == NULL) fatal("cannot find unit %s in library %s", istr(top_level), istr(lib_name(lib_work()))); elab_verbose(verbose, "loading top-level unit"); tree_t e = elab(unit); if (e == NULL) return EXIT_FAILURE; elab_verbose(verbose, "elaborating design"); opt(e); elab_verbose(verbose, "optimising design"); group_nets(e); elab_verbose(verbose, "grouping nets"); // Save the library now so the code generator can attach temporary // meta data to trees lib_save(lib_work()); elab_verbose(verbose, "saving library"); lower_unit(e); elab_verbose(verbose, "generating intermediate code"); cgen(e); elab_verbose(verbose, "generating LLVM"); link_bc(e); elab_verbose(verbose, "linking"); argc -= next_cmd - 1; argv += next_cmd - 1; return argc > 1 ? process_command(argc, argv) : EXIT_SUCCESS; }