diff options
author | tholo <> | 1996-08-10 05:03:00 +0000 |
---|---|---|
committer | tholo <> | 1996-08-10 05:03:00 +0000 |
commit | ea8898fbe860e3adebd38dc68bec346523f7c0f9 (patch) | |
tree | ef4803b61acba4f66cf2e617b3e8f219cfac9eee | |
parent | b47bb26d644943498c1dbb9525143b311e066041 (diff) | |
download | openbsd-ea8898fbe860e3adebd38dc68bec346523f7c0f9.tar.gz openbsd-ea8898fbe860e3adebd38dc68bec346523f7c0f9.tar.bz2 openbsd-ea8898fbe860e3adebd38dc68bec346523f7c0f9.zip |
Minor formatting fixes from Lite2
Correct return value of putenv(3), also from Lite2
-rw-r--r-- | src/lib/libc/stdlib/getenv.3 | 13 | ||||
-rw-r--r-- | src/lib/libc/stdlib/putenv.c | 19 |
2 files changed, 15 insertions, 17 deletions
diff --git a/src/lib/libc/stdlib/getenv.3 b/src/lib/libc/stdlib/getenv.3 index 411eb35da4..24a8d3d095 100644 --- a/src/lib/libc/stdlib/getenv.3 +++ b/src/lib/libc/stdlib/getenv.3 | |||
@@ -1,5 +1,5 @@ | |||
1 | .\" Copyright (c) 1988, 1991 The Regents of the University of California. | 1 | .\" Copyright (c) 1988, 1991, 1993 |
2 | .\" All rights reserved. | 2 | .\" The Regents of the University of California. All rights reserved. |
3 | .\" | 3 | .\" |
4 | .\" This code is derived from software contributed to Berkeley by | 4 | .\" This code is derived from software contributed to Berkeley by |
5 | .\" the American National Standards Committee X3, on Information | 5 | .\" the American National Standards Committee X3, on Information |
@@ -33,10 +33,9 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" from: @(#)getenv.3 6.11 (Berkeley) 6/29/91 | 36 | .\" $OpenBSD: getenv.3,v 1.2 1996/08/10 05:03:00 tholo Exp $ |
37 | .\" $Id: getenv.3,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $ | ||
38 | .\" | 37 | .\" |
39 | .Dd June 29, 1991 | 38 | .Dd December 11, 1993 |
40 | .Dt GETENV 3 | 39 | .Dt GETENV 3 |
41 | .Os | 40 | .Os |
42 | .Sh NAME | 41 | .Sh NAME |
@@ -75,7 +74,7 @@ function obtains the current value of the environment variable, | |||
75 | .Ar name . | 74 | .Ar name . |
76 | If the variable | 75 | If the variable |
77 | .Ar name | 76 | .Ar name |
78 | is not in the current environment , | 77 | is not in the current environment, |
79 | a null pointer is returned. | 78 | a null pointer is returned. |
80 | .Pp | 79 | .Pp |
81 | The | 80 | The |
@@ -121,7 +120,7 @@ return zero if successful; otherwise the global variable | |||
121 | is set to indicate the error and a | 120 | is set to indicate the error and a |
122 | \-1 is returned. | 121 | \-1 is returned. |
123 | .Sh ERRORS | 122 | .Sh ERRORS |
124 | .Bl -tag -width Er | 123 | .Bl -tag -width [ENOMEM] |
125 | .It Bq Er ENOMEM | 124 | .It Bq Er ENOMEM |
126 | The function | 125 | The function |
127 | .Fn setenv | 126 | .Fn setenv |
diff --git a/src/lib/libc/stdlib/putenv.c b/src/lib/libc/stdlib/putenv.c index 2194c2c608..d8c4886d4b 100644 --- a/src/lib/libc/stdlib/putenv.c +++ b/src/lib/libc/stdlib/putenv.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /*- | 1 | /*- |
2 | * Copyright (c) 1988 The Regents of the University of California. | 2 | * Copyright (c) 1988, 1993 |
3 | * All rights reserved. | 3 | * The Regents of the University of California. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -32,8 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | /*static char *sccsid = "from: @(#)putenv.c 5.4 (Berkeley) 2/23/91";*/ | 35 | static char *rcsid = "$OpenBSD: putenv.c,v 1.2 1996/08/10 05:03:00 tholo Exp $"; |
36 | static char *rcsid = "$Id: putenv.c,v 1.1.1.1 1995/10/18 08:42:18 deraadt Exp $"; | ||
37 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
38 | 37 | ||
39 | #include <stdlib.h> | 38 | #include <stdlib.h> |
@@ -43,17 +42,17 @@ int | |||
43 | putenv(str) | 42 | putenv(str) |
44 | const char *str; | 43 | const char *str; |
45 | { | 44 | { |
46 | register char *p, *equal; | 45 | char *p, *equal; |
47 | int rval; | 46 | int rval; |
48 | 47 | ||
49 | if (!(p = strdup(str))) | 48 | if ((p = strdup(str)) == NULL) |
50 | return(1); | 49 | return (-1); |
51 | if (!(equal = strchr(p, '='))) { | 50 | if ((equal = strchr(p, '=')) == NULL) { |
52 | (void)free(p); | 51 | (void)free(p); |
53 | return(1); | 52 | return (-1); |
54 | } | 53 | } |
55 | *equal = '\0'; | 54 | *equal = '\0'; |
56 | rval = setenv(p, equal + 1, 1); | 55 | rval = setenv(p, equal + 1, 1); |
57 | (void)free(p); | 56 | (void)free(p); |
58 | return(rval); | 57 | return (rval); |
59 | } | 58 | } |