X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/81598a815d6b6c901f4c7252153861839e23e4df..851a428e76e2ea81cf1594174858f228e9dc7734:/sftp.c diff --git a/sftp.c b/sftp.c index c994887e..78f8ca17 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.116 2010/01/04 02:03:57 djm Exp $ */ +/* $OpenBSD: sftp.c,v 1.118 2010/01/09 11:13:02 dtucker Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1112,17 +1112,18 @@ parse_args(const char **cpp, int *pflag, int *rflag, int *lflag, int *iflag, /* Skip leading whitespace */ cp = cp + strspn(cp, WHITESPACE); - /* Ignore blank lines and lines which begin with comment '#' char */ - if (*cp == '\0' || *cp == '#') - return (0); - /* Check for leading '-' (disable error processing) */ *iflag = 0; if (*cp == '-') { *iflag = 1; cp++; + cp = cp + strspn(cp, WHITESPACE); } + /* Ignore blank lines and lines which begin with comment '#' char */ + if (*cp == '\0' || *cp == '#') + return (0); + if ((argv = makeargv(cp, &argc, 0, NULL, NULL)) == NULL) return -1; @@ -1568,7 +1569,7 @@ complete_ambiguous(const char *word, char **list, size_t count) if (matchlen > strlen(word)) { char *tmp = xstrdup(list[0]); - tmp[matchlen] = NULL; + tmp[matchlen] = '\0'; return tmp; } } @@ -1645,7 +1646,6 @@ complete_cmd_parse(EditLine *el, char *cmd, int lastarg, char quote, return count; } -#endif /* * Determine whether a particular sftp command's arguments (if any) @@ -1666,7 +1666,6 @@ complete_is_remote(char *cmd) { return -1; } -#ifdef USE_LIBEDIT /* Autocomplete a filename "file" */ static int complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path, @@ -2064,7 +2063,7 @@ int main(int argc, char **argv) { int in, out, ch, err; - char *host, *userhost, *cp, *file2 = NULL; + char *host = NULL, *userhost, *cp, *file2 = NULL; int debug_level = 0, sshver = 2; char *file1 = NULL, *sftp_server = NULL; char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL;