From 1b77fa4e36e50258936a4b61fdb11a988d473b1a Mon Sep 17 00:00:00 2001 From: Leo C Date: Mon, 21 Mar 2016 23:33:05 +0100 Subject: [PATCH] Rename getenv() to getenv_char() getenv() is declared in some avr-libc versions. --- avr/cli.c | 6 +++--- avr/cmd_gpio.c | 2 +- avr/cmd_loadcpm3.c | 2 +- avr/env.c | 2 +- avr/main.c | 2 +- avr/z180-serv.c | 2 +- include/env.h | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/avr/cli.c b/avr/cli.c index e66554a..8763ed1 100644 --- a/avr/cli.c +++ b/avr/cli.c @@ -177,7 +177,7 @@ char *process_macros(char *input, char *output) if (c == '}') { /* Terminate variable name */ *(inp-1) = '\0'; - const char *envval = getenv(varname); + const char *envval = getenv_char(varname); *(inp-1) = '}'; /* Copy into the line if it exists */ if (envval != NULL) @@ -210,7 +210,7 @@ char *process_macros(char *input, char *output) * WARNING: * * We must create a temporary copy of the command since the command we get - * may be the result from getenv(), which returns a pointer directly to + * may be the result from getenv_char(), which returns a pointer directly to * the environment data, which may change magicly when the command we run * creates or modifies environment variables (like "bootp" does). * @@ -398,7 +398,7 @@ command_ret_t do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) for (i = 1; i < argc; ++i) { char *arg; - arg = getenv(argv[i]); + arg = getenv_char(argv[i]); if (arg == NULL) { printf_P(PSTR("## Error: \"%s\" is not set\n"), argv[i]); return CMD_RET_FAILURE; diff --git a/avr/cmd_gpio.c b/avr/cmd_gpio.c index 5589381..6b7b3f7 100644 --- a/avr/cmd_gpio.c +++ b/avr/cmd_gpio.c @@ -37,7 +37,7 @@ static void pinnames_get(void) /* TODO: enters endless loop on wrong parameters */ - if ((lp = getenv(PSTR(ENV_PINALIAS))) != NULL) { + if ((lp = getenv_char(PSTR(ENV_PINALIAS))) != NULL) { pin_names[namestr] = strdup(lp); ptr = strtok_P(pin_names[namestr], delim1); while (ptr != NULL) { diff --git a/avr/cmd_loadcpm3.c b/avr/cmd_loadcpm3.c index 324a40d..a2436f2 100644 --- a/avr/cmd_loadcpm3.c +++ b/avr/cmd_loadcpm3.c @@ -86,7 +86,7 @@ command_ret_t do_loadcpm3(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg if (argc > 2) common_base = strtoul(argv[2], NULL, 16); - fname = getenv(PSTR(ENV_CPM3_SYSFILE)); + fname = getenv_char(PSTR(ENV_CPM3_SYSFILE)); if (argc > 1) { fname = argv[1]; } diff --git a/avr/env.c b/avr/env.c index 9ea355f..c4837d5 100644 --- a/avr/env.c +++ b/avr/env.c @@ -316,7 +316,7 @@ int env_init(void) } -char *getenv(const MEMX char *name) +char *getenv_char(const MEMX char *name) { env_item_t *ep; char *ret = NULL; diff --git a/avr/main.c b/avr/main.c index b8ce26d..113b4f2 100644 --- a/avr/main.c +++ b/avr/main.c @@ -224,7 +224,7 @@ const char *bootdelay_process(void) debug("### main_loop entered: bootdelay=%d\n\n", bootdelay); _delay_ms(20); - s = getenv(PSTR(ENV_BOOTCMD)); + s = getenv_char(PSTR(ENV_BOOTCMD)); stored_bootdelay = bootdelay; return s; } diff --git a/avr/z180-serv.c b/avr/z180-serv.c index a815537..58843fd 100644 --- a/avr/z180-serv.c +++ b/avr/z180-serv.c @@ -317,7 +317,7 @@ void do_msg_cpm_login(uint8_t subf, int len, uint8_t * msg) strcpy_P((char *)disk_buffer, PSTR("dsk0")); disk_buffer[3] = msg[0] + '0'; - if (((np = getenv((char*)disk_buffer)) == NULL) || + if (((np = getenv_char((char*)disk_buffer)) == NULL) || ((drv_table[drv].img_name = strdup(np)) == NULL)) { return msg_cpm_result(subf, 0x03, res); } diff --git a/include/env.h b/include/env.h index da38c54..c7e49ca 100644 --- a/include/env.h +++ b/include/env.h @@ -9,7 +9,7 @@ int env_init(void); -char *getenv(const MEMX char *name); +char *getenv_char(const MEMX char *name); unsigned long getenv_ulong(const MEMX char *name, int base, unsigned long default_val); int setenv_ulong(const MEMX char *varname, unsigned long value); int setenv_hex(const MEMX char *varname, unsigned long value); -- 2.39.2