Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 1 | .\" ************************************************************************** |
| 2 | .\" * _ _ ____ _ |
| 3 | .\" * Project ___| | | | _ \| | |
| 4 | .\" * / __| | | | |_) | | |
| 5 | .\" * | (__| |_| | _ <| |___ |
| 6 | .\" * \___|\___/|_| \_\_____| |
| 7 | .\" * |
Elliott Hughes | 34dd5f4 | 2021-08-10 13:01:18 -0700 | [diff] [blame] | 8 | .\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 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 |
Elliott Hughes | 34dd5f4 | 2021-08-10 13:01:18 -0700 | [diff] [blame] | 12 | .\" * are also available at https://curl.se/docs/copyright.html. |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 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 | .\" ************************************************************************** |
Elliott Hughes | f344baa | 2021-12-07 09:12:34 -0800 | [diff] [blame] | 22 | .TH curl_getenv 3 "October 31, 2021" "libcurl 7.80.0" "libcurl Manual" |
Elliott Hughes | 82be86d | 2017-09-20 17:00:17 -0700 | [diff] [blame] | 23 | |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 24 | .SH NAME |
| 25 | curl_getenv - return value for environment name |
| 26 | .SH SYNOPSIS |
| 27 | .B #include <curl/curl.h> |
| 28 | .sp |
| 29 | .BI "char *curl_getenv(const char *" name ");" |
| 30 | .ad |
| 31 | .SH DESCRIPTION |
| 32 | curl_getenv() is a portable wrapper for the getenv() function, meant to |
Elliott Hughes | 34dd5f4 | 2021-08-10 13:01:18 -0700 | [diff] [blame] | 33 | emulate its behavior and provide an identical interface for all operating |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 34 | systems libcurl builds on (including win32). |
Haibo Huang | b51266f | 2020-03-04 02:22:48 -0800 | [diff] [blame] | 35 | |
Elliott Hughes | f344baa | 2021-12-07 09:12:34 -0800 | [diff] [blame] | 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 |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 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 |
Haibo Huang | ca2a802 | 2020-07-10 20:17:42 -0700 | [diff] [blame] | 50 | A pointer to a null-terminated string or NULL if it failed to find the |
Haibo Huang | b51266f | 2020-03-04 02:22:48 -0800 | [diff] [blame] | 51 | specified name. |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 52 | .SH NOTE |
Elliott Hughes | f344baa | 2021-12-07 09:12:34 -0800 | [diff] [blame] | 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 |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 55 | unix implementation thus has to suffer slightly from the drawbacks of other |
| 56 | systems. |
| 57 | .SH "SEE ALSO" |
| 58 | .BR getenv "(3C), " |