int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char buffer[CONFIG_SYS_CBSIZE]; char *init_val; if (argc < 2) return CMD_RET_USAGE; /* Set read buffer to initial value or empty sting */ init_val = getenv(argv[1]); if (init_val) sprintf(buffer, "%s", init_val); else buffer[0] = '\0'; readline_into_buffer("edit: ", buffer, 0); return setenv(argv[1], buffer); }
static void ait_menu_read_env(char *name) { char output[CONFIG_SYS_CBSIZE]; char cbuf[CONFIG_SYS_CBSIZE]; int readret; int ret; sprintf(output, "%s old: %s value: ", name, getenv(name)); memset(cbuf, 0, CONFIG_SYS_CBSIZE); readret = readline_into_buffer(output, cbuf, 0); if (readret >= 0) { ret = setenv(name, cbuf); if (ret) { printf("Error setting %s\n", name); return; } } return; }
int do_editenv(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { char buffer[CONFIG_SYS_CBSIZE]; char *init_val; int len; if (argc < 2) { cmd_usage(cmdtp); return 1; } /* Set read buffer to initial value or empty sting */ init_val = getenv(argv[1]); if (init_val) len = sprintf(buffer, "%s", init_val); else buffer[0] = '\0'; readline_into_buffer("edit: ", buffer); return setenv(argv[1], buffer); }
static int do_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int nbytes, menu; //printf( "CONFIG_SYS_CBSIZE=%d\n", CONFIG_SYS_CBSIZE ); setenv_common(); while (1) { printf(fmt_menu, EZB_VER_STR, NAND_ADDR_ENV, get_ezb_strv(F_IDX_ETHADDR), get_ezb_strv(F_IDX_IPADDR), get_ezb_strv(F_IDX_NETMASK), get_ezb_strv(F_IDX_GATEWAYIP), get_ezb_strv(F_IDX_SERVERIP), get_ezb_strv(F_IDX_KERNEL), get_ezb_strv(F_IDX_RAMDISK), get_ezb_strv(F_IDX_UBOOT), get_ezb_strv(F_IDX_DT), get_ezb_strv(F_IDX_AUTOEXEC), get_ezb_strv(F_IDX_BOOTDELAY), get_ezb_strv(F_IDX_KCMD1), get_ezb_strv(F_IDX_KCMD2), get_ezb_strv(F_IDX_KCMD3), get_ezb_strv(F_IDX_KCMD4), get_ezb_strv(F_IDX_KCMD5), get_ezb_strv(F_IDX_BOOT_MODE) // add:lbb ); // 입력 대기 nbytes = readline(" select> "); if (0 < nbytes) { char *ptr = console_buffer; switch (*ptr) { case 's': case 'S': saveenv(); break; case 'q': case 'Q': return 0; case 'l': case 'L': rootfs_change(ptr[1]); break; } // 숫자 메뉴 확인 menu = simple_strtoul(ptr, NULL, 0); menu -= 1; if ((0 <= menu) && (menu < F_IDX_COUNT)) { char buffer[CONFIG_SYS_CBSIZE]; char *init_val; init_val = getenv(ezb_key[menu]); if (init_val) sprintf(buffer, "%s", init_val); else buffer[0] = '\0'; if (0 <= readline_into_buffer(" edit> ", buffer)) { setenv(ezb_key[menu], buffer); } // add:lbb // boot mode if (menu == 16) { setenv_common(); } } } } return 0; }