summaryrefslogtreecommitdiff
path: root/regress/netcat.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2016-08-06 10:49:58 +0100
committerColin Watson <cjwatson@debian.org>2016-08-06 10:49:58 +0100
commita8ed8d256b2e2c05b0c15565a7938028c5192277 (patch)
tree87abbdc914a38b43e4e5bb9581ad1f46eabbf88e /regress/netcat.c
parentf0329aac23c61e1a5197d6d57349a63f459bccb0 (diff)
parent99522ba7ec6963a05c04a156bf20e3ba3605987c (diff)
Import openssh_7.3p1.orig.tar.gz
Diffstat (limited to 'regress/netcat.c')
-rw-r--r--regress/netcat.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/regress/netcat.c b/regress/netcat.c
index 6234ba019..98a08b1ec 100644
--- a/regress/netcat.c
+++ b/regress/netcat.c
@@ -61,6 +61,9 @@
61# include <sys/poll.h> 61# include <sys/poll.h>
62# endif 62# endif
63#endif 63#endif
64#ifdef HAVE_ERR_H
65# include <err.h>
66#endif
64 67
65/* Telnet options from arpa/telnet.h */ 68/* Telnet options from arpa/telnet.h */
66#define IAC 255 69#define IAC 255
@@ -134,46 +137,6 @@ void usage(int);
134ssize_t drainbuf(int, unsigned char *, size_t *); 137ssize_t drainbuf(int, unsigned char *, size_t *);
135ssize_t fillbuf(int, unsigned char *, size_t *); 138ssize_t fillbuf(int, unsigned char *, size_t *);
136 139
137static void err(int, const char *, ...) __attribute__((format(printf, 2, 3)));
138static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
139static void warn(const char *, ...) __attribute__((format(printf, 1, 2)));
140
141static void
142err(int r, const char *fmt, ...)
143{
144 va_list args;
145
146 va_start(args, fmt);
147 fprintf(stderr, "%s: ", strerror(errno));
148 vfprintf(stderr, fmt, args);
149 fputc('\n', stderr);
150 va_end(args);
151 exit(r);
152}
153
154static void
155errx(int r, const char *fmt, ...)
156{
157 va_list args;
158
159 va_start(args, fmt);
160 vfprintf(stderr, fmt, args);
161 fputc('\n', stderr);
162 va_end(args);
163 exit(r);
164}
165
166static void
167warn(const char *fmt, ...)
168{
169 va_list args;
170
171 va_start(args, fmt);
172 fprintf(stderr, "%s: ", strerror(errno));
173 vfprintf(stderr, fmt, args);
174 fputc('\n', stderr);
175 va_end(args);
176}
177 140
178int 141int
179main(int argc, char *argv[]) 142main(int argc, char *argv[])