1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_getenv 5Section: 3 6Source: libcurl 7See-also: 8 - getenv (3C) 9--- 10 11# NAME 12 13curl_getenv - return value for environment name 14 15# SYNOPSIS 16 17~~~c 18#include <curl/curl.h> 19 20char *curl_getenv(const char *name); 21~~~ 22 23# DESCRIPTION 24 25curl_getenv() is a portable wrapper for the getenv() function, meant to 26emulate its behavior and provide an identical interface for all operating 27systems libcurl builds on (including win32). 28 29You must curl_free(3) the returned string when you are done with it. 30 31# EXAMPLE 32 33~~~c 34int main(void) 35{ 36 char *width = curl_getenv("COLUMNS"); 37 if(width) { 38 /* it was set! */ 39 curl_free(width); 40 } 41} 42~~~ 43 44# AVAILABILITY 45 46Always 47 48# RETURN VALUE 49 50A pointer to a null-terminated string or NULL if it failed to find the 51specified name. 52 53# NOTE 54 55Under unix operating systems, there is no point in returning an allocated 56memory, although other systems does not work properly if this is not done. The 57unix implementation thus suffers slightly from the drawbacks of other systems. 58