static void set_work_lib(void) { const char *work_name = opt_get_str("work-name"); lib_t work = lib_find(work_name, false, false); if (work == NULL) work = lib_new(work_name); lib_set_work(work); }
static void setup(void) { work = lib_new("test_lib", "/tmp/test_lib"); fail_if(work == NULL); }
static void setup(void) { work = lib_new("work"); fail_if(work == NULL); }
int main(int argc, char **argv) { term_init(); set_default_opts(); intern_strings(); if (getenv("NVC_GDB") != NULL) register_gdb_signal_handlers(); else register_trace_signal_handlers(); if (is_debugger_running()) atexit(tree_gc); atexit(fbuf_cleanup); static struct option long_options[] = { { "help", no_argument, 0, 'h' }, { "version", no_argument, 0, 'v' }, { "work", required_argument, 0, 'w' }, { "std", required_argument, 0, 's' }, { "messages", required_argument, 0, 'M' }, { "map", required_argument, 0, 'p' }, { "ignore-time", no_argument, 0, 'i' }, { "force-init", no_argument, 0, 'f' }, { 0, 0, 0, 0 } }; opterr = 0; const char *work_name = "work"; const char *work_path = work_name; lib_t work = NULL; const int next_cmd = scan_cmd(1, argc, argv); int c, index = 0; const char *spec = "aehrvL:"; while ((c = getopt_long(next_cmd, argv, spec, long_options, &index)) != -1) { switch (c) { case 0: // Set a flag break; case 'h': usage(); exit(EXIT_SUCCESS); case 'v': printf("%s\n%s\n", version_string, copy_string); exit(EXIT_SUCCESS); case 'w': parse_work_name(optarg, &work_name, &work_path); break; case 'L': lib_add_search_path(optarg); break; case 's': set_standard(parse_standard(optarg)); break; case 'M': set_message_style(parse_message_style(optarg)); break; case 'p': parse_library_map(optarg); break; case 'i': opt_set_int("ignore-time", 1); break; case 'f': opt_set_int("force-init", 1); break; case '?': fatal("unrecognised global option %s", argv[optind - 1]); default: abort(); } } work = lib_new(work_name, work_path); lib_set_work(work); argc -= next_cmd - 1; argv += next_cmd - 1; return process_command(argc, argv); }