From d504b9157f95f67a4ed4c4bc18104d1acf0ba351 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 16 Jun 2003 19:02:01 +0000 Subject: [PATCH] * ftp.c (recvrequest): Add new argument indicating whether "-" and "|..." special treatment should be disabled. * ftp_var.h (recvrequest): Update declaration. * cmds.c (remglob, ls, mls): Pass 0 as the extra argument. (mget): Pass 1. (getit): Pass 1 iff only one filename was supplied. ticket: 1351 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15626 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftp/ChangeLog | 9 +++++++++ src/appl/gssftp/ftp/cmds.c | 10 +++++----- src/appl/gssftp/ftp/ftp.c | 8 ++++---- src/appl/gssftp/ftp/ftp_var.h | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/appl/gssftp/ftp/ChangeLog b/src/appl/gssftp/ftp/ChangeLog index 614948dbb..445734fb2 100644 --- a/src/appl/gssftp/ftp/ChangeLog +++ b/src/appl/gssftp/ftp/ChangeLog @@ -1,3 +1,12 @@ +2003-06-16 Ken Raeburn + + * ftp.c (recvrequest): Add new argument indicating whether "-" and + "|..." special treatment should be disabled. + * ftp_var.h (recvrequest): Update declaration. + * cmds.c (remglob, ls, mls): Pass 0 as the extra argument. + (mget): Pass 1. + (getit): Pass 1 iff only one filename was supplied. + 2003-06-05 Sam Hartman * pclose.c (mypopen): use fork not vfork diff --git a/src/appl/gssftp/ftp/cmds.c b/src/appl/gssftp/ftp/cmds.c index 38d721473..b9cb2a2a2 100644 --- a/src/appl/gssftp/ftp/cmds.c +++ b/src/appl/gssftp/ftp/cmds.c @@ -940,7 +940,7 @@ usage: } recvrequest("RETR", argv[2], argv[1], rmode, - argv[1] != oldargv1 || argv[2] != oldargv2); + argv[1] != oldargv1 || argv[2] != oldargv2, loc); restart_point = 0; return (0); } @@ -1017,7 +1017,7 @@ void mget(argc, argv) tp = domap(tp); } recvrequest("RETR", tp, cp, "w", - tp != cp || !interactive); + tp != cp || !interactive, 1); if (!mflag && fromatty) { ointer = interactive; interactive = 1; @@ -1085,7 +1085,7 @@ remglob(argv,doswitch) pswitch(!proxy); } for (rmode = "w"; *++argv != NULL; rmode = "a") - recvrequest ("NLST", temp, *argv, rmode, 0); + recvrequest ("NLST", temp, *argv, rmode, 0, 0); if (doswitch) { pswitch(!proxy); } @@ -1455,7 +1455,7 @@ void ls(argc, argv) code = -1; return; } - recvrequest(cmd, argv[2], argv[1], "w", 0); + recvrequest(cmd, argv[2], argv[1], "w", 0, 0); } /* @@ -1493,7 +1493,7 @@ usage: (void) setjmp(jabort); for (i = 1; mflag && i < argc-1; ++i) { *rmode = (i == 1) ? 'w' : 'a'; - recvrequest(cmd, dest, argv[i], rmode, 0); + recvrequest(cmd, dest, argv[i], rmode, 0, 0); if (!mflag && fromatty) { ointer = interactive; interactive = 1; diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c index ffbb42cd5..155f85792 100644 --- a/src/appl/gssftp/ftp/ftp.c +++ b/src/appl/gssftp/ftp/ftp.c @@ -1103,7 +1103,7 @@ abortrecv(int sig) } void recvrequest(char *cmd, char *volatile local, char *remote, char *lmode, - int printnames) + int printnames, int fnameonly) { FILE *volatile fout, *volatile din = 0, *popen(); int (*volatile closefunc)(), pclose(), fclose(); @@ -1149,7 +1149,7 @@ void recvrequest(char *cmd, char *volatile local, char *remote, char *lmode, return; } oldintr = signal(SIGINT, abortrecv); - if (strcmp(local, "-") && *local != '|') { + if (fnameonly || (strcmp(local, "-") && *local != '|')) { if (access(local, 2) < 0) { char *dir = strrchr(local, '/'); @@ -1223,9 +1223,9 @@ void recvrequest(char *cmd, char *volatile local, char *remote, char *lmode, din = dataconn("r"); if (din == NULL) goto die; - if (strcmp(local, "-") == 0) + if (strcmp(local, "-") == 0 && !fnameonly) fout = stdout; - else if (*local == '|') { + else if (*local == '|' && !fnameonly) { #ifdef SIGPIPE oldintp = signal(SIGPIPE, SIG_IGN); #endif diff --git a/src/appl/gssftp/ftp/ftp_var.h b/src/appl/gssftp/ftp/ftp_var.h index 4448448aa..9baa04730 100644 --- a/src/appl/gssftp/ftp/ftp_var.h +++ b/src/appl/gssftp/ftp/ftp_var.h @@ -249,7 +249,7 @@ void setpassive (void); /* ftp.c */ void sendrequest (char *, char *, char *, int); -void recvrequest (char *, char *volatile, char *, char *, int); +void recvrequest (char *, char *volatile, char *, char *, int, int); int login (char *); void setpbsz (unsigned int); void pswitch (int); -- 2.26.2