curl_getenv(3)

curl_getenv3

Return value for environment name

Usage

#include <curl/curl.h>
char *curl_getenv(const char *name);

Overview

curl_getenv() is a portable wrapper for the getenv() function, meant to emulate its behavior and provide an identical interface for all operating systems libcurl builds on (including win32).

You must curl_free(3) the returned string when you are done with it.

Examples

int main(void)
{
  char *width = curl_getenv("COLUMNS");
  if(width) {
    /* it was set! */
    curl_free(width);
  }
}

Return value

A pointer to a null-terminated string or NULL if it failed to find the specified name.

Note

Under unix operating systems, there is no point in returning an allocated memory, although other systems does not work properly if this is not done. The unix implementation thus suffers slightly from the drawbacks of other systems.

Releases

155 releases since Mac OS X 10.2; the text changed 19 times.

  1. 10.2–10.2.8
  2. 10.3–10.3.9
  3. 10.4–10.4.11
  4. 10.5–10.5.8
  5. 10.6–10.6.8
  6. 10.7–10.7.5
  7. 10.8–10.11.6
  8. 10.12–10.12.5
  9. 10.12.6–10.14.6
  10. 10.15–11.5
  11. 12.0.1–12.2
  12. 12.3–12.5
  13. 13.0
  14. 13.1
  15. 13.2
  16. 13.3
  17. 13.4
  18. 13.5–14.1
  19. 14.2–14.4
  20. 14.5–26.5

Availability

Always

From curl 166.0.0.0.1 in macOS 26.5. Parsed by carta from the page's man source.