diff options
author | Damien Miller <djm@mindrot.org> | 2003-05-19 00:13:38 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2003-05-19 00:13:38 +1000 |
commit | 317412502b900ddecdafdfa171da99271846478b (patch) | |
tree | 2e04f618288cdf0c16a98b675b28b8287a15a0c6 /openbsd-compat/bsd-misc.c | |
parent | e323df6c4851b04386e747a009474f469fe97137 (diff) |
- (djm) Big KNF on openbsd-compat/
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r-- | openbsd-compat/bsd-misc.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index b8e9996d5..cdc63c24d 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 1999-2000 Damien Miller. All rights reserved. | 2 | * Copyright (c) 1999-2003 Damien Miller. All rights reserved. |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
@@ -25,7 +25,7 @@ | |||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | #include "xmalloc.h" | 26 | #include "xmalloc.h" |
27 | 27 | ||
28 | RCSID("$Id: bsd-misc.c,v 1.12 2003/03/18 18:21:41 tim Exp $"); | 28 | RCSID("$Id: bsd-misc.c,v 1.13 2003/05/18 14:13:39 djm Exp $"); |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * NB. duplicate __progname in case it is an alias for argv[0] | 31 | * NB. duplicate __progname in case it is an alias for argv[0] |
@@ -41,21 +41,21 @@ char *get_progname(char *argv0) | |||
41 | char *p; | 41 | char *p; |
42 | 42 | ||
43 | if (argv0 == NULL) | 43 | if (argv0 == NULL) |
44 | return "unknown"; /* XXX */ | 44 | return ("unknown"); /* XXX */ |
45 | p = strrchr(argv0, '/'); | 45 | p = strrchr(argv0, '/'); |
46 | if (p == NULL) | 46 | if (p == NULL) |
47 | p = argv0; | 47 | p = argv0; |
48 | else | 48 | else |
49 | p++; | 49 | p++; |
50 | 50 | ||
51 | return xstrdup(p); | 51 | return (xstrdup(p)); |
52 | #endif | 52 | #endif |
53 | } | 53 | } |
54 | 54 | ||
55 | #ifndef HAVE_SETLOGIN | 55 | #ifndef HAVE_SETLOGIN |
56 | int setlogin(const char *name) | 56 | int setlogin(const char *name) |
57 | { | 57 | { |
58 | return(0); | 58 | return (0); |
59 | } | 59 | } |
60 | #endif /* !HAVE_SETLOGIN */ | 60 | #endif /* !HAVE_SETLOGIN */ |
61 | 61 | ||
@@ -63,21 +63,21 @@ int setlogin(const char *name) | |||
63 | int innetgr(const char *netgroup, const char *host, | 63 | int innetgr(const char *netgroup, const char *host, |
64 | const char *user, const char *domain) | 64 | const char *user, const char *domain) |
65 | { | 65 | { |
66 | return(0); | 66 | return (0); |
67 | } | 67 | } |
68 | #endif /* HAVE_INNETGR */ | 68 | #endif /* HAVE_INNETGR */ |
69 | 69 | ||
70 | #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) | 70 | #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) |
71 | int seteuid(uid_t euid) | 71 | int seteuid(uid_t euid) |
72 | { | 72 | { |
73 | return(setreuid(-1,euid)); | 73 | return (setreuid(-1, euid)); |
74 | } | 74 | } |
75 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ | 75 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ |
76 | 76 | ||
77 | #if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) | 77 | #if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) |
78 | int setegid(uid_t egid) | 78 | int setegid(uid_t egid) |
79 | { | 79 | { |
80 | return(setresgid(-1,egid,-1)); | 80 | return(setresgid(-1, egid, -1)); |
81 | } | 81 | } |
82 | #endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */ | 82 | #endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */ |
83 | 83 | ||
@@ -88,9 +88,9 @@ const char *strerror(int e) | |||
88 | extern char *sys_errlist[]; | 88 | extern char *sys_errlist[]; |
89 | 89 | ||
90 | if ((e >= 0) && (e < sys_nerr)) | 90 | if ((e >= 0) && (e < sys_nerr)) |
91 | return(sys_errlist[e]); | 91 | return (sys_errlist[e]); |
92 | else | 92 | |
93 | return("unlisted error"); | 93 | return ("unlisted error"); |
94 | } | 94 | } |
95 | #endif | 95 | #endif |
96 | 96 | ||
@@ -102,24 +102,25 @@ int utimes(char *filename, struct timeval *tvp) | |||
102 | ub.actime = tvp[0].tv_sec; | 102 | ub.actime = tvp[0].tv_sec; |
103 | ub.modtime = tvp[1].tv_sec; | 103 | ub.modtime = tvp[1].tv_sec; |
104 | 104 | ||
105 | return(utime(filename, &ub)); | 105 | return (utime(filename, &ub)); |
106 | } | 106 | } |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | #ifndef HAVE_TRUNCATE | 109 | #ifndef HAVE_TRUNCATE |
110 | int truncate (const char *path, off_t length) | 110 | int truncate(const char *path, off_t length) |
111 | { | 111 | { |
112 | int fd, ret, saverrno; | 112 | int fd, ret, saverrno; |
113 | 113 | ||
114 | fd = open(path, O_WRONLY); | 114 | fd = open(path, O_WRONLY); |
115 | if (fd < 0) | 115 | if (fd < 0) |
116 | return -1; | 116 | return (-1); |
117 | 117 | ||
118 | ret = ftruncate(fd, length); | 118 | ret = ftruncate(fd, length); |
119 | saverrno = errno; | 119 | saverrno = errno; |
120 | (void) close (fd); | 120 | close(fd); |
121 | if (ret == -1) | 121 | if (ret == -1) |
122 | errno = saverrno; | 122 | errno = saverrno; |
123 | |||
123 | return(ret); | 124 | return(ret); |
124 | } | 125 | } |
125 | #endif /* HAVE_TRUNCATE */ | 126 | #endif /* HAVE_TRUNCATE */ |
@@ -131,7 +132,7 @@ int truncate (const char *path, off_t length) | |||
131 | int | 132 | int |
132 | setgroups(size_t size, const gid_t *list) | 133 | setgroups(size_t size, const gid_t *list) |
133 | { | 134 | { |
134 | return 0; | 135 | return (0); |
135 | } | 136 | } |
136 | #endif | 137 | #endif |
137 | 138 | ||