main.c (b9fabe997febc799cdaf751bdfb669e3c296e2b3) main.c (92570f67c7911126ce742a3dfe1b97046091ed0e)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 70 unchanged lines hidden (view full) ---

79
80#define MAXLINE (2 * MAXPATHLEN)
81#define TIMEOUT 5 /* secs between rexmt's */
82
83typedef struct sockaddr_storage peeraddr;
84static int connected;
85static char mode[32];
86static jmp_buf toplevel;
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 70 unchanged lines hidden (view full) ---

79
80#define MAXLINE (2 * MAXPATHLEN)
81#define TIMEOUT 5 /* secs between rexmt's */
82
83typedef struct sockaddr_storage peeraddr;
84static int connected;
85static char mode[32];
86static jmp_buf toplevel;
87volatile int txrx_error;
87static int txrx_error;
88static int peer;
89
90#define MAX_MARGV 20
91static int margc;
92static char *margv[MAX_MARGV];
93
94int verbose;
95static char *port = NULL;

--- 400 unchanged lines hidden (view full) ---

496 close(fd);
497 return;
498 }
499 options_set_request(OPT_TSIZE, "%ju", (uintmax_t)sb.st_size);
500
501 if (verbose)
502 printf("putting %s to %s:%s [%s]\n",
503 cp, hostname, targ, mode);
88static int peer;
89
90#define MAX_MARGV 20
91static int margc;
92static char *margv[MAX_MARGV];
93
94int verbose;
95static char *port = NULL;

--- 400 unchanged lines hidden (view full) ---

496 close(fd);
497 return;
498 }
499 options_set_request(OPT_TSIZE, "%ju", (uintmax_t)sb.st_size);
500
501 if (verbose)
502 printf("putting %s to %s:%s [%s]\n",
503 cp, hostname, targ, mode);
504 xmitfile(peer, port, fd, targ, mode);
504 if (xmitfile(peer, port, fd, targ, mode))
505 txrx_error = 1;
505 close(fd);
506 return;
507 }
508 /* this assumes the target is a directory */
509 /* on a remote unix system. hmmmm. */
510 for (n = 1; n < argc - 1; n++) {
511 if (asprintf(&path, "%s/%s", targ, tail(argv[n])) < 0)
512 err(1, "malloc");

--- 11 unchanged lines hidden (view full) ---

524 free(path);
525 continue;
526 }
527 options_set_request(OPT_TSIZE, "%ju", (uintmax_t)sb.st_size);
528
529 if (verbose)
530 printf("putting %s to %s:%s [%s]\n",
531 argv[n], hostname, path, mode);
506 close(fd);
507 return;
508 }
509 /* this assumes the target is a directory */
510 /* on a remote unix system. hmmmm. */
511 for (n = 1; n < argc - 1; n++) {
512 if (asprintf(&path, "%s/%s", targ, tail(argv[n])) < 0)
513 err(1, "malloc");

--- 11 unchanged lines hidden (view full) ---

525 free(path);
526 continue;
527 }
528 options_set_request(OPT_TSIZE, "%ju", (uintmax_t)sb.st_size);
529
530 if (verbose)
531 printf("putting %s to %s:%s [%s]\n",
532 argv[n], hostname, path, mode);
532 xmitfile(peer, port, fd, path, mode);
533 if (xmitfile(peer, port, fd, path, mode) != 0)
534 txrx_error = 1;
533 close(fd);
534
535 free(path);
536 }
537}
538
539static void
540putusage(char *s)

--- 59 unchanged lines hidden (view full) ---

600 fd = creat(cp, 0644);
601 if (fd < 0) {
602 warn("%s", cp);
603 return;
604 }
605 if (verbose)
606 printf("getting from %s:%s to %s [%s]\n",
607 hostname, src, cp, mode);
535 close(fd);
536
537 free(path);
538 }
539}
540
541static void
542putusage(char *s)

--- 59 unchanged lines hidden (view full) ---

602 fd = creat(cp, 0644);
603 if (fd < 0) {
604 warn("%s", cp);
605 return;
606 }
607 if (verbose)
608 printf("getting from %s:%s to %s [%s]\n",
609 hostname, src, cp, mode);
608 recvfile(peer, port, fd, src, mode);
610 if (recvfile(peer, port, fd, src, mode) != 0)
611 txrx_error = 1;
609 break;
610 }
611 cp = tail(src); /* new .. jdg */
612 fd = creat(cp, 0644);
613 if (fd < 0) {
614 warn("%s", cp);
615 continue;
616 }
617 if (verbose)
618 printf("getting from %s:%s to %s [%s]\n",
619 hostname, src, cp, mode);
612 break;
613 }
614 cp = tail(src); /* new .. jdg */
615 fd = creat(cp, 0644);
616 if (fd < 0) {
617 warn("%s", cp);
618 continue;
619 }
620 if (verbose)
621 printf("getting from %s:%s to %s [%s]\n",
622 hostname, src, cp, mode);
620 recvfile(peer, port, fd, src, mode);
623 if (recvfile(peer, port, fd, src, mode) != 0)
624 txrx_error = 1;
621 }
622}
623
624static void
625getusage(char *s)
626{
627
628 printf("usage: %s file [localname]\n", s);

--- 470 unchanged lines hidden ---
625 }
626}
627
628static void
629getusage(char *s)
630{
631
632 printf("usage: %s file [localname]\n", s);

--- 470 unchanged lines hidden ---