summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1996-08-10 05:03:00 +0000
committertholo <tholo@openbsd.org>1996-08-10 05:03:00 +0000
commit9a2c72deb4e1493140301844ab158850b9738b4e (patch)
treeb63a43840bcc59355f2580fdfd69d17f9a0b1e7d /lib/libc/stdlib
parentFix typo; from Lite2 (diff)
downloadwireguard-openbsd-9a2c72deb4e1493140301844ab158850b9738b4e.tar.xz
wireguard-openbsd-9a2c72deb4e1493140301844ab158850b9738b4e.zip
Minor formatting fixes from Lite2
Correct return value of putenv(3), also from Lite2
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/getenv.313
-rw-r--r--lib/libc/stdlib/putenv.c19
2 files changed, 15 insertions, 17 deletions
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
index 411eb35da4b..24a8d3d0953 100644
--- a/lib/libc/stdlib/getenv.3
+++ b/lib/libc/stdlib/getenv.3
@@ -1,5 +1,5 @@
-.\" Copyright (c) 1988, 1991 The Regents of the University of California.
-.\" All rights reserved.
+.\" Copyright (c) 1988, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the American National Standards Committee X3, on Information
@@ -33,10 +33,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)getenv.3 6.11 (Berkeley) 6/29/91
-.\" $Id: getenv.3,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $
+.\" $OpenBSD: getenv.3,v 1.2 1996/08/10 05:03:00 tholo Exp $
.\"
-.Dd June 29, 1991
+.Dd December 11, 1993
.Dt GETENV 3
.Os
.Sh NAME
@@ -75,7 +74,7 @@ function obtains the current value of the environment variable,
.Ar name .
If the variable
.Ar name
-is not in the current environment ,
+is not in the current environment,
a null pointer is returned.
.Pp
The
@@ -121,7 +120,7 @@ return zero if successful; otherwise the global variable
is set to indicate the error and a
\-1 is returned.
.Sh ERRORS
-.Bl -tag -width Er
+.Bl -tag -width [ENOMEM]
.It Bq Er ENOMEM
The function
.Fn setenv
diff --git a/lib/libc/stdlib/putenv.c b/lib/libc/stdlib/putenv.c
index 2194c2c6089..d8c4886d4b1 100644
--- a/lib/libc/stdlib/putenv.c
+++ b/lib/libc/stdlib/putenv.c
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)putenv.c 5.4 (Berkeley) 2/23/91";*/
-static char *rcsid = "$Id: putenv.c,v 1.1.1.1 1995/10/18 08:42:18 deraadt Exp $";
+static char *rcsid = "$OpenBSD: putenv.c,v 1.2 1996/08/10 05:03:00 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
@@ -43,17 +42,17 @@ int
putenv(str)
const char *str;
{
- register char *p, *equal;
+ char *p, *equal;
int rval;
- if (!(p = strdup(str)))
- return(1);
- if (!(equal = strchr(p, '='))) {
+ if ((p = strdup(str)) == NULL)
+ return (-1);
+ if ((equal = strchr(p, '=')) == NULL) {
(void)free(p);
- return(1);
+ return (-1);
}
*equal = '\0';
rval = setenv(p, equal + 1, 1);
(void)free(p);
- return(rval);
+ return (rval);
}