/*---------------------------------------------------------------------------*/ static int handle_config(const char *arg) { char name[64]; const char *opt; int arg_len; arg_len = index_of('=', (const uint8_t *)arg, 0, strlen(arg)); if(arg_len > 0 && arg_len < sizeof(name)) { memcpy(name, arg, arg_len); name[arg_len] = '\0'; opt = arg + arg_len + 1; if(strcmp("channel", name) == 0) { dectoi((const uint8_t *)opt, strlen(opt), &br_config_radio_channel); return 1; } if(strcmp("panid", name) == 0) { dectoi((const uint8_t *)opt, strlen(opt), &br_config_radio_panid); return 1; } } fprintf(stderr, "*** Unsupported configuration: %s\n", arg); return 0; }
static void parse_options (int argc, char **argv) { int c; do { int num = 0; c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpQr:s:S:tTu:w:xZ:"); if (optarg != NULL) num = dectoi (optarg); if (c == 'a') f_setup.attribute_assignment = 1; if (c == 'A') f_setup.attribute_testing = 1; if (c == 'b') user_background = num; if (c == 'B') user_reverse_bg = num; if (c == 'c') f_setup.context_lines = num; if (c == 'd') { display = optarg[0] | 32; if ((display < '0' || display > '5') && (display < 'a' || display > 'e')) { display = -1; } } if (c == 'e') user_emphasis = num; if (c == 'T') user_bold_typing = 1; if (c == 'f') user_foreground = num; if (c == 'F') user_reverse_fg = num; if (c == 'g') { if (num >= 0 && num <= 4) user_font = num; } if (c == 'h') user_screen_height = num; if (c == 'i') f_setup.ignore_errors = 1; if (c == 'l') f_setup.left_margin = num; if (c == 'o') f_setup.object_movement = 1; if (c == 'O') f_setup.object_locating = 1; if (c == 'p') f_setup.piracy = 1; if (c == 'Q') f_setup.save_quetzal = 0; if (c == 'r') f_setup.right_margin = num; if (c == 's') user_random_seed = num; if (c == 'S') f_setup.script_cols = num; if (c == 't') user_tandy_bit = 1; if (c == 'u') f_setup.undo_slots = num; if (c == 'w') user_screen_width = num; if (c == 'x') f_setup.expand_abbreviations = 1; if (c == 'Z') { if (num >= ERR_REPORT_NEVER && num <= ERR_REPORT_FATAL) f_setup.err_report_mode = num; } if (c == '?') optind = argc; } while (c != EOF && c != '?'); }/* parse_options */