コード例 #1
0
ファイル: stdcmd.c プロジェクト: noccy80/mspdebug
int cmd_opt(char **arg)
{
	const char *opt_text = get_arg(arg);
	struct opdb_key key;
	union opdb_value value;

	if (opt_text) {
		if (opdb_get(opt_text, &key, &value) < 0) {
			printc_err("opt: no such option: %s\n",
				opt_text);
			return -1;
		}
	}

	if (**arg) {
		if (parse_option(key.type, &value, *arg) < 0) {
			printc_err("opt: can't parse option: %s\n",
				*arg);
			return -1;
		}

		opdb_set(key.name, &value);
	} else if (opt_text) {
		display_option(NULL, &key, &value);
	} else {
		opdb_enum(display_option, NULL);
	}

	return 0;
}
コード例 #2
0
ファイル: MainRemote.c プロジェクト: gabrielebe/ROVER
void menu_update(int action) {
    switch (action) { // the action depends on the button that has changed
        case 0: m++;
            break;
        case 1: m--;
            break;
        case 2: if (m == 1) {
                submenu = 1;
                m = 0;
            }
            break;
        case 3: if (submenu == 1) {
                submenu = 0;
                m = 0;
            }
            break;
    }//switch
    if (m < 0) m = 0;
    if (m > 4) m = 4;
    display_option(m, submenu);
}//menu_update