summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-03-05 04:54:49 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-03-05 04:54:49 +0000
commitb0a4cd8f9174fbf14e1345a96585d19795b052c5 (patch)
tree75b23792a02c21fc5b3144e765aaeac5622209a8 /ssh-keyscan.c
parent53992c7cd50b2b6fea696b8593ee1fca7cef21fa (diff)
- deraadt@cvs.openbsd.org 2001/02/21 07:37:04
[ssh-keyscan.c] inline -> __inline__, and some indent
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 5cd368e93..a8fb028d8 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -8,7 +8,7 @@
8 */ 8 */
9 9
10#include "includes.h" 10#include "includes.h"
11RCSID("$OpenBSD: ssh-keyscan.c,v 1.16 2001/02/12 22:56:10 deraadt Exp $"); 11RCSID("$OpenBSD: ssh-keyscan.c,v 1.17 2001/02/21 07:37:04 deraadt Exp $");
12 12
13#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) 13#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
14#include <sys/queue.h> 14#include <sys/queue.h>
@@ -89,7 +89,7 @@ typedef struct {
89 void (*errfun) (const char *,...); 89 void (*errfun) (const char *,...);
90} Linebuf; 90} Linebuf;
91 91
92static inline Linebuf * 92static __inline__ Linebuf *
93Linebuf_alloc(const char *filename, void (*errfun) (const char *,...)) 93Linebuf_alloc(const char *filename, void (*errfun) (const char *,...))
94{ 94{
95 Linebuf *lb; 95 Linebuf *lb;
@@ -123,7 +123,7 @@ Linebuf_alloc(const char *filename, void (*errfun) (const char *,...))
123 return (lb); 123 return (lb);
124} 124}
125 125
126static inline void 126static __inline__ void
127Linebuf_free(Linebuf * lb) 127Linebuf_free(Linebuf * lb)
128{ 128{
129 fclose(lb->stream); 129 fclose(lb->stream);
@@ -131,7 +131,7 @@ Linebuf_free(Linebuf * lb)
131 xfree(lb); 131 xfree(lb);
132} 132}
133 133
134static inline void 134static __inline__ void
135Linebuf_restart(Linebuf * lb) 135Linebuf_restart(Linebuf * lb)
136{ 136{
137 clearerr(lb->stream); 137 clearerr(lb->stream);
@@ -139,13 +139,13 @@ Linebuf_restart(Linebuf * lb)
139 lb->lineno = 0; 139 lb->lineno = 0;
140} 140}
141 141
142static inline int 142static __inline__ int
143Linebuf_lineno(Linebuf * lb) 143Linebuf_lineno(Linebuf * lb)
144{ 144{
145 return (lb->lineno); 145 return (lb->lineno);
146} 146}
147 147
148static inline char * 148static __inline__ char *
149Linebuf_getline(Linebuf * lb) 149Linebuf_getline(Linebuf * lb)
150{ 150{
151 int n = 0; 151 int n = 0;
@@ -155,7 +155,8 @@ Linebuf_getline(Linebuf * lb)
155 /* Read a line */ 155 /* Read a line */
156 if (!fgets(&lb->buf[n], lb->size - n, lb->stream)) { 156 if (!fgets(&lb->buf[n], lb->size - n, lb->stream)) {
157 if (ferror(lb->stream) && lb->errfun) 157 if (ferror(lb->stream) && lb->errfun)
158 (*lb->errfun) ("%s: %s\n", lb->filename, strerror(errno)); 158 (*lb->errfun) ("%s: %s\n", lb->filename,
159 strerror(errno));
159 return (NULL); 160 return (NULL);
160 } 161 }
161 n = strlen(lb->buf); 162 n = strlen(lb->buf);
@@ -167,13 +168,15 @@ Linebuf_getline(Linebuf * lb)
167 } 168 }
168 if (n != lb->size - 1) { 169 if (n != lb->size - 1) {
169 if (lb->errfun) 170 if (lb->errfun)
170 (*lb->errfun) ("%s: skipping incomplete last line\n", lb->filename); 171 (*lb->errfun) ("%s: skipping incomplete last line\n",
172 lb->filename);
171 return (NULL); 173 return (NULL);
172 } 174 }
173 /* Double the buffer if we need more space */ 175 /* Double the buffer if we need more space */
174 if (!(lb->buf = realloc(lb->buf, (lb->size *= 2)))) { 176 if (!(lb->buf = realloc(lb->buf, (lb->size *= 2)))) {
175 if (lb->errfun) 177 if (lb->errfun)
176 (*lb->errfun) ("linebuf (%s): realloc failed\n", lb->filename); 178 (*lb->errfun) ("linebuf (%s): realloc failed\n",
179 lb->filename);
177 return (NULL); 180 return (NULL);
178 } 181 }
179 } 182 }
@@ -184,6 +187,7 @@ fdlim_get(int hard)
184{ 187{
185#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) 188#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
186 struct rlimit rlfd; 189 struct rlimit rlfd;
190
187 if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) 191 if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
188 return (-1); 192 return (-1);
189 if ((hard ? rlfd.rlim_max : rlfd.rlim_cur) == RLIM_INFINITY) 193 if ((hard ? rlfd.rlim_max : rlfd.rlim_cur) == RLIM_INFINITY)
@@ -222,7 +226,7 @@ fdlim_set(int lim)
222 * separators. This is the same as the 4.4BSD strsep, but different from the 226 * separators. This is the same as the 4.4BSD strsep, but different from the
223 * one in the GNU libc. 227 * one in the GNU libc.
224 */ 228 */
225inline char * 229static __inline__ char *
226xstrsep(char **str, const char *delim) 230xstrsep(char **str, const char *delim)
227{ 231{
228 char *s, *e; 232 char *s, *e;