Bugzilla – Attachment 750 Details for
Bug 634
Make sftp (mostly) compatible with scp commandline
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
scp-like commandline syntax for sftp
sftp-scp-syntax.patch (text/plain), 2.23 KB, created by
Andrew Mortensen
on 2004-12-08 03:08:33 AEDT
(
hide
)
Description:
scp-like commandline syntax for sftp
Filename:
MIME Type:
Creator:
Andrew Mortensen
Created:
2004-12-08 03:08:33 AEDT
Size:
2.23 KB
patch
obsolete
>--- sftp.c.orig Tue Dec 7 11:06:59 2004 >+++ sftp.c Tue Dec 7 10:59:42 2004 >@@ -145,7 +145,7 @@ > { NULL, -1} > }; > >-int interactive_loop(int fd_in, int fd_out, char *file1, char *file2); >+int interactive_loop(int fd_in, int fd_out, char *file1, char *file2, char *op); > > static void > killchild(int signo) >@@ -1221,7 +1247,7 @@ > #endif > > int >-interactive_loop(int fd_in, int fd_out, char *file1, char *file2) >+interactive_loop(int fd_in, int fd_out, char *file1, char *file2, char *op) > { > char *pwd; > char *dir = NULL; >@@ -1260,7 +1286,8 @@ > > if (file1 != NULL) { > dir = xstrdup(file1); >- dir = make_absolute(dir, pwd); >+ if (strcmp(op, "get") == 0) >+ dir = make_absolute(dir, pwd); > > if (remote_is_dir(conn, dir) && file2 == NULL) { > printf("Changing to: %s\n", dir); >@@ -1269,9 +1296,9 @@ > return (-1); > } else { > if (file2 == NULL) >- snprintf(cmd, sizeof cmd, "get %s", dir); >+ snprintf(cmd, sizeof cmd, "%s %s", op, dir); > else >- snprintf(cmd, sizeof cmd, "get %s %s", dir, >+ snprintf(cmd, sizeof cmd, "%s %s %s", op, dir, > file2); > > err = parse_dispatch_command(conn, cmd, &pwd, 1); >@@ -1411,7 +1438,7 @@ > main(int argc, char **argv) > { > int in, out, ch, err; >- char *host, *userhost, *cp, *file2 = NULL; >+ char *host, *userhost, *cp, *file2 = NULL, *op = "get"; > int debug_level = 0, sshver = 2; > char *file1 = NULL, *sftp_server = NULL; > char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL; >@@ -1499,6 +1526,16 @@ > > userhost = xstrdup(argv[optind]); > file2 = argv[optind+1]; >+ >+ if (file2 && colon(file2)) { /* dest is remote host */ >+ xfree(userhost); >+ userhost = xstrdup(file2); >+ file1 = argv[optind]; >+ cp = colon(userhost); >+ *cp++ = '\0'; >+ file2 = cp; >+ op = "put"; >+ } > > if ((host = strrchr(userhost, '@')) == NULL) > host = userhost; >@@ -1511,7 +1548,7 @@ > addargs(&args, "-l%s",userhost); > } > >- if ((cp = colon(host)) != NULL) { >+ if (!file1 && (cp = colon(host)) != NULL) { > *cp++ = '\0'; > file1 = cp; > } >@@ -1545,7 +1582,7 @@ > connect_to_server(sftp_direct, args.list, &in, &out); > } > >- err = interactive_loop(in, out, file1, file2); >+ err = interactive_loop(in, out, file1, file2, op); > > #if !defined(USE_PIPES) > shutdown(in, SHUT_RDWR);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 634
: 750