blob: 1ec6c66d435c7e372de2246176a77c41454f67cf [file] [log] [blame]
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001.\" **************************************************************************
2.\" * _ _ ____ _
3.\" * Project ___| | | | _ \| |
4.\" * / __| | | | |_) | |
5.\" * | (__| |_| | _ <| |___
6.\" * \___|\___/|_| \_\_____|
7.\" *
Elliott Hughes34dd5f42021-08-10 13:01:18 -07008.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07009.\" *
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 Hughes34dd5f42021-08-10 13:01:18 -070012.\" * are also available at https://curl.se/docs/copyright.html.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070013.\" *
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 Hughesf344baa2021-12-07 09:12:34 -080022.TH curl_getenv 3 "October 31, 2021" "libcurl 7.80.0" "libcurl Manual"
Elliott Hughes82be86d2017-09-20 17:00:17 -070023
Lucas Eckels9bd90e62012-08-06 15:07:02 -070024.SH NAME
25curl_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
32curl_getenv() is a portable wrapper for the getenv() function, meant to
Elliott Hughes34dd5f42021-08-10 13:01:18 -070033emulate its behavior and provide an identical interface for all operating
Lucas Eckels9bd90e62012-08-06 15:07:02 -070034systems libcurl builds on (including win32).
Haibo Huangb51266f2020-03-04 02:22:48 -080035
Elliott Hughesf344baa2021-12-07 09:12:34 -080036You 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 Eckels9bd90e62012-08-06 15:07:02 -070045.SH AVAILABILITY
46This function will be removed from the public libcurl API in a near future. It
47will instead be made "available" by source code access only, and then as
48curlx_getenv().
49.SH RETURN VALUE
Haibo Huangca2a8022020-07-10 20:17:42 -070050A pointer to a null-terminated string or NULL if it failed to find the
Haibo Huangb51266f2020-03-04 02:22:48 -080051specified name.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070052.SH NOTE
Elliott Hughesf344baa2021-12-07 09:12:34 -080053Under unix operating systems, there is no point in returning an allocated
54memory, although other systems will not work properly if this is not done. The
Lucas Eckels9bd90e62012-08-06 15:07:02 -070055unix implementation thus has to suffer slightly from the drawbacks of other
56systems.
57.SH "SEE ALSO"
58.BR getenv "(3C), "