curl_getenv.3 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_getenv 3 "May 17, 2022" "libcurl 7.85.0" "libcurl Manual"
  25. .SH NAME
  26. curl_getenv - return value for environment name
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. char *curl_getenv(const char *name);
  31. .fi
  32. .SH DESCRIPTION
  33. curl_getenv() is a portable wrapper for the getenv() function, meant to
  34. emulate its behavior and provide an identical interface for all operating
  35. systems libcurl builds on (including win32).
  36. You must \fIcurl_free(3)\fP the returned string when you are done with it.
  37. .SH EXAMPLE
  38. .nf
  39. char *width = curl_getenv("COLUMNS");
  40. if(width) {
  41. /* it was set! */
  42. curl_free(width);
  43. }
  44. .fi
  45. .SH AVAILABILITY
  46. This function will be removed from the public libcurl API in a near future. It
  47. will instead be made "available" by source code access only, and then as
  48. curlx_getenv().
  49. .SH RETURN VALUE
  50. A pointer to a null-terminated string or NULL if it failed to find the
  51. specified name.
  52. .SH NOTE
  53. Under unix operating systems, there is no point in returning an allocated
  54. memory, although other systems will not work properly if this is not done. The
  55. unix implementation thus has to suffer slightly from the drawbacks of other
  56. systems.
  57. .SH "SEE ALSO"
  58. .BR getenv "(3C), "