]> andersk Git - openssh.git/blobdiff - scp.c
Oops.. =) mispelt NGROUPS_MAX.
[openssh.git] / scp.c
diff --git a/scp.c b/scp.c
index 1f8de388158fd5d7aed3d01ef9ca4e8af67f3ba3..f8f123af4f8b24fc1a65b04aa501c3b1ad432aa8 100644 (file)
--- a/scp.c
+++ b/scp.c
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.44 2000/12/11 17:27:33 deraadt Exp $");
+RCSID("$OpenBSD: scp.c,v 1.51 2001/01/21 19:05:55 markus Exp $");
 
-#include "ssh.h"
 #include "xmalloc.h"
-
-#ifndef _PATH_CP
-#define _PATH_CP "cp"
-#endif
+#include "atomicio.h"
+#include "pathnames.h"
+#include "log.h"
 
 #ifdef HAVE___PROGNAME
 extern char *__progname;
@@ -115,7 +113,7 @@ void addargs(char *fmt, ...) __attribute__((format(printf, 1, 2)));
 static struct timeval start;
 
 /* Number of bytes of current file transferred so far. */
-volatile unsigned long statbytes;
+volatile u_long statbytes;
 
 /* Total size of current file. */
 off_t totalbytes = 0;
@@ -126,14 +124,11 @@ char *curfile;
 /* This is set to non-zero to enable verbose mode. */
 int verbose_mode = 0;
 
-/* This is set to non-zero if compression is desired. */
-int compress_flag = 0;
-
 /* This is set to zero if the progressmeter is not desired. */
 int showprogress = 1;
 
 /* This is the program to execute for the secured connection. ("ssh" or -S) */
-char *ssh_program = SSH_PROGRAM;
+char *ssh_program = _PATH_SSH_PROGRAM;
 
 /* This is the list of arguments that scp passes to ssh */
 struct {
@@ -201,19 +196,6 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc)
        return 0;
 }
 
-void
-fatal(const char *fmt,...)
-{
-       va_list ap;
-       char buf[1024];
-
-       va_start(ap, fmt);
-       vsnprintf(buf, sizeof(buf), fmt, ap);
-       va_end(ap);
-       fprintf(stderr, "%s\n", buf);
-       exit(255);
-}
-
 typedef struct {
        int cnt;
        char *buf;
@@ -263,7 +245,7 @@ main(argc, argv)
        addargs("-oFallBackToRsh no");
 
        fflag = tflag = 0;
-       while ((ch = getopt(argc, argv, "dfprtvBCc:i:P:q46S:o:")) != EOF)
+       while ((ch = getopt(argc, argv, "dfprtvBCc:i:P:q46S:o:")) != -1)
                switch (ch) {
                /* User-visible flags. */
                case '4':
@@ -550,16 +532,16 @@ syserr:                   run_err("%s: %s", name, strerror(errno));
                         * versions expecting microseconds.
                         */
                        (void) sprintf(buf, "T%lu 0 %lu 0\n",
-                           (unsigned long) stb.st_mtime,
-                           (unsigned long) stb.st_atime);
+                           (u_long) stb.st_mtime,
+                           (u_long) stb.st_atime);
                        (void) atomicio(write, remout, buf, strlen(buf));
                        if (response() < 0)
                                goto next;
                }
 #define        FILEMODEMASK    (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
                sprintf(buf, "C%04o %lu %s\n",
-                   (unsigned int) (stb.st_mode & FILEMODEMASK),
-                   (unsigned long) stb.st_size, last);
+                   (u_int) (stb.st_mode & FILEMODEMASK),
+                   (u_long) stb.st_size, last);
                if (verbose_mode) {
                        fprintf(stderr, "Sending file modes: %s", buf);
                        fflush(stderr);
@@ -627,8 +609,8 @@ rsource(name, statp)
                last++;
        if (pflag) {
                (void) sprintf(path, "T%lu 0 %lu 0\n",
-                   (unsigned long) statp->st_mtime,
-                   (unsigned long) statp->st_atime);
+                   (u_long) statp->st_mtime,
+                   (u_long) statp->st_atime);
                (void) atomicio(write, remout, path, strlen(path));
                if (response() < 0) {
                        closedir(dirp);
@@ -636,7 +618,7 @@ rsource(name, statp)
                }
        }
        (void) sprintf(path, "D%04o %d %.1024s\n",
-           (unsigned int) (statp->st_mode & FILEMODEMASK), 0, last);
+           (u_int) (statp->st_mode & FILEMODEMASK), 0, last);
        if (verbose_mode)
                fprintf(stderr, "Entering directory: %s", path);
        (void) atomicio(write, remout, path, strlen(path));
@@ -1049,7 +1031,8 @@ okname(cp0)
                c = *cp;
                if (c & 0200)
                        goto bad;
-               if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
+               if (!isalpha(c) && !isdigit(c) &&
+                   c != '_' && c != '-' && c != '.' && c != '+')
                        goto bad;
        } while (*++cp);
        return (1);
@@ -1128,11 +1111,7 @@ foregroundproc()
        if (pgrp == -1)
                pgrp = getpgrp();
 
-#ifdef HAVE_CYGWIN
-       /*
-        * Cygwin only supports tcgetpgrp() for getting the controlling tty
-         * currently.
-        */
+#ifdef HAVE_TCGETPGRP
        return ((ctty_pgrp = tcgetpgrp(STDOUT_FILENO)) != -1 &&
                ctty_pgrp == pgrp);
 #else
This page took 0.040949 seconds and 4 git commands to generate.