-/* $OpenBSD: sftp.c,v 1.119 2010/01/13 01:40:16 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.123 2010/01/27 19:21:39 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
"df [-hi] [path] Display statistics for current directory or\n"
" filesystem containing 'path'\n"
"exit Quit sftp\n"
- "get [-Pr] remote-path [local-path] Download file\n"
+ "get [-Ppr] remote [local] Download file\n"
"help Display this help text\n"
"lcd path Change local directory to 'path'\n"
"lls [ls-options [path]] Display local directory listing\n"
"lmkdir path Create local directory\n"
"ln oldpath newpath Symlink remote file\n"
"lpwd Print local working directory\n"
- "ls [-1aflnrSt] [path] Display remote directory listing\n"
+ "ls [-1afhlnrSt] [path] Display remote directory listing\n"
"lumask umask Set local umask to 'umask'\n"
"mkdir path Create remote directory\n"
"progress Toggle display of progress meter\n"
- "put [-Pr] local-path [remote-path] Upload file\n"
+ "put [-Ppr] local [remote] Upload file\n"
"pwd Display remote working directory\n"
"quit Quit sftp\n"
"rename oldpath newpath Rename remote file\n"
}
lf = el_line(el);
- /*
- * XXX should we really extend here? the user may not be done if
- * the filename is a directory.
- */
if (g.gl_matchc == 1) {
i = 0;
if (!terminated)
ins[i++] = quote;
- if (lastarg || *(lf->cursor) != ' ')
+ if (*(lf->cursor - 1) != '/' &&
+ (lastarg || *(lf->cursor) != ' '))
ins[i++] = ' ';
ins[i] = '\0';
if (i > 0 && el_insertstr(el, ins) == -1)
* The underlying ssh is in the same process group, so we must
* ignore SIGINT if we want to gracefully abort commands,
* otherwise the signal will make it to the ssh process and
- * kill it too
+ * kill it too. Contrawise, since sftp sends SIGTERMs to the
+ * underlying ssh, it must *not* ignore that signal.
*/
signal(SIGINT, SIG_IGN);
+ signal(SIGTERM, SIG_DFL);
execvp(path, args);
fprintf(stderr, "exec: %s: %s\n", path, strerror(errno));
_exit(1);
infile = stdin;
while ((ch = getopt(argc, argv,
- "1246hqrvCc:D:i:o:s:S:b:B:F:P:R:")) != -1) {
+ "1246hpqrvCc:D:i:o:s:S:b:B:F:P:R:")) != -1) {
switch (ch) {
/* Passed through to ssh(1) */
case '4':