46 |
#include <arpa/ftp.h> |
#include <arpa/ftp.h> |
47 |
|
|
48 |
#include <ctype.h> |
#include <ctype.h> |
49 |
#include <err.h> |
#include <error.h> |
50 |
#include <netdb.h> |
#include <netdb.h> |
51 |
#include <pwd.h> |
#include <pwd.h> |
52 |
#include <signal.h> |
#include <signal.h> |
121 |
|
|
122 |
sp = getservbyname ("ftp", "tcp"); |
sp = getservbyname ("ftp", "tcp"); |
123 |
if (sp == 0) |
if (sp == 0) |
124 |
errx (1, "ftp/tcp: unknown service"); |
error (1, 0, "ftp/tcp: unknown service"); |
125 |
doglob = 1; |
doglob = 1; |
126 |
interactive = 1; |
interactive = 1; |
127 |
autologin = 1; |
autologin = 1; |
213 |
|
|
214 |
if (setjmp (toplevel)) |
if (setjmp (toplevel)) |
215 |
exit (0); |
exit (0); |
216 |
(void) signal(SIGINT, intr); |
signal(SIGINT, intr); |
217 |
(void) signal(SIGPIPE, lostpeer); |
signal(SIGPIPE, lostpeer); |
218 |
xargv[0] = __progname; |
xargv[0] = __progname; |
219 |
xargv[1] = argv[0]; |
xargv[1] = argv[0]; |
220 |
xargv[2] = argv[1]; |
xargv[2] = argv[1]; |
225 |
top = setjmp (toplevel) == 0; |
top = setjmp (toplevel) == 0; |
226 |
if (top) |
if (top) |
227 |
{ |
{ |
228 |
(void) signal (SIGINT, intr); |
signal (SIGINT, intr); |
229 |
(void) signal (SIGPIPE, lostpeer); |
signal (SIGPIPE, lostpeer); |
230 |
} |
} |
231 |
for (;;) |
for (;;) |
232 |
{ |
{ |
235 |
} |
} |
236 |
} |
} |
237 |
|
|
238 |
void |
RETSIGTYPE |
239 |
intr (int sig) |
intr (int sig ARG_UNUSED) |
240 |
{ |
{ |
241 |
longjmp (toplevel, 1); |
longjmp (toplevel, 1); |
242 |
} |
} |
243 |
|
|
244 |
void |
RETSIGTYPE |
245 |
lostpeer (int sig) |
lostpeer (int sig ARG_UNUSED) |
246 |
{ |
{ |
247 |
if (connected) |
if (connected) |
248 |
{ |
{ |
249 |
if (cout != NULL) |
if (cout != NULL) |
250 |
{ |
{ |
251 |
(void) shutdown (fileno (cout), 1+1); |
shutdown (fileno (cout), 1+1); |
252 |
(void) fclose (cout); |
fclose (cout); |
253 |
cout = NULL; |
cout = NULL; |
254 |
} |
} |
255 |
if (data >= 0) |
if (data >= 0) |
256 |
{ |
{ |
257 |
(void) shutdown (data, 1+1); |
shutdown (data, 1+1); |
258 |
(void) close (data); |
close (data); |
259 |
data = -1; |
data = -1; |
260 |
} |
} |
261 |
connected = 0; |
connected = 0; |
265 |
{ |
{ |
266 |
if (cout != NULL) |
if (cout != NULL) |
267 |
{ |
{ |
268 |
(void) shutdown (fileno(cout), 1+1); |
shutdown (fileno(cout), 1+1); |
269 |
(void) fclose (cout); |
fclose (cout); |
270 |
cout = NULL; |
cout = NULL; |
271 |
} |
} |
272 |
connected = 0; |
connected = 0; |
304 |
int l; |
int l; |
305 |
|
|
306 |
if (!top) |
if (!top) |
307 |
(void) putchar ('\n'); |
putchar ('\n'); |
308 |
for (;;) |
for (;;) |
309 |
{ |
{ |
310 |
|
|
375 |
} |
} |
376 |
(*c->c_handler) (margc, margv); |
(*c->c_handler) (margc, margv); |
377 |
if (bell && c->c_bell) |
if (bell && c->c_bell) |
378 |
(void) putchar('\007'); |
putchar('\007'); |
379 |
if (c->c_handler != help) |
if (c->c_handler != help) |
380 |
break; |
break; |
381 |
} |
} |
382 |
(void) signal (SIGINT, intr); |
signal (SIGINT, intr); |
383 |
(void) signal (SIGPIPE, lostpeer); |
signal (SIGPIPE, lostpeer); |
384 |
} |
} |
385 |
|
|
386 |
/* |
/* |