
York Sun wrote:
From: James Yang James.Yang@freescale.com
getenv_f() searches the environment for a variable name and copies the value of the variable to a buffer pointed to by one of the function's parameters. However, this means that the buffer needs to exist and needs to be of sufficient length (passed as another parameter to getenv_f()) to hold the requested variable's value, even if all that is desired is the mere detection of the existence of the variable itself.
This patch removes the requirement that the buffer needs to exist. If the pointer to the buffer is set to NULL and the requested variable is found, getenv_f() returns 1, else it returns -1. The buffer length parameter is ignored if the pointer is set to NULL. The original functionality of getenv_f() is retained (return number of bytes copied if variable is found, -1 if not), other than being able to copy the variable's value to the address 0.
Signed-off-by: James Yang James.Yang@freescale.com
Acked-by: Timur Tabi timur@freescale.com