diff options
author | Colin Watson <cjwatson@debian.org> | 2016-08-06 10:49:58 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-08-06 10:49:58 +0100 |
commit | a8ed8d256b2e2c05b0c15565a7938028c5192277 (patch) | |
tree | 87abbdc914a38b43e4e5bb9581ad1f46eabbf88e /regress/netcat.c | |
parent | f0329aac23c61e1a5197d6d57349a63f459bccb0 (diff) | |
parent | 99522ba7ec6963a05c04a156bf20e3ba3605987c (diff) |
Import openssh_7.3p1.orig.tar.gz
Diffstat (limited to 'regress/netcat.c')
-rw-r--r-- | regress/netcat.c | 43 |
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); | |||
134 | ssize_t drainbuf(int, unsigned char *, size_t *); | 137 | ssize_t drainbuf(int, unsigned char *, size_t *); |
135 | ssize_t fillbuf(int, unsigned char *, size_t *); | 138 | ssize_t fillbuf(int, unsigned char *, size_t *); |
136 | 139 | ||
137 | static void err(int, const char *, ...) __attribute__((format(printf, 2, 3))); | ||
138 | static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3))); | ||
139 | static void warn(const char *, ...) __attribute__((format(printf, 1, 2))); | ||
140 | |||
141 | static void | ||
142 | err(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 | |||
154 | static void | ||
155 | errx(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 | |||
166 | static void | ||
167 | warn(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 | ||
178 | int | 141 | int |
179 | main(int argc, char *argv[]) | 142 | main(int argc, char *argv[]) |