(sendrequest): add argument for mode to open file in.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6258 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-05-21 09:20:10 +00:00
parent c8895d60f5
commit cf9ae9ec30

View File

@@ -179,7 +179,7 @@ login (char *host)
if(sec_login(host)) if(sec_login(host))
printf("\n*** Using plaintext user and password ***\n\n"); printf("\n*** Using plaintext user and password ***\n\n");
else{ else{
printf("Kerberos authentication successful.\n\n"); printf("Authentication successful.\n\n");
} }
if (ruserpass (host, &user, &pass, &acct) < 0) { if (ruserpass (host, &user, &pass, &acct) < 0) {
@@ -606,7 +606,7 @@ copy_stream (FILE * from, FILE * to)
} }
void void
sendrequest (char *cmd, char *local, char *remote, int printnames) sendrequest (char *cmd, char *local, char *remote, char *lmode, int printnames)
{ {
struct stat st; struct stat st;
struct timeval start, stop; struct timeval start, stop;
@@ -615,7 +615,7 @@ sendrequest (char *cmd, char *local, char *remote, int printnames)
int (*closefunc) (FILE *); int (*closefunc) (FILE *);
RETSIGTYPE (*oldintr)(), (*oldintp)(); RETSIGTYPE (*oldintr)(), (*oldintp)();
long bytes = 0, hashbytes = HASHBYTES; long bytes = 0, hashbytes = HASHBYTES;
char *lmode; char *rmode;
if (verbose && printnames) { if (verbose && printnames) {
if (local && strcmp (local, "-") != 0) if (local && strcmp (local, "-") != 0)
@@ -653,7 +653,7 @@ sendrequest (char *cmd, char *local, char *remote, int printnames)
fin = stdin; fin = stdin;
else if (*local == '|') { else if (*local == '|') {
oldintp = signal (SIGPIPE, SIG_IGN); oldintp = signal (SIGPIPE, SIG_IGN);
fin = popen (local + 1, "r"); fin = popen (local + 1, lmode);
if (fin == NULL) { if (fin == NULL) {
warn ("%s", local + 1); warn ("%s", local + 1);
signal (SIGINT, oldintr); signal (SIGINT, oldintr);
@@ -663,7 +663,7 @@ sendrequest (char *cmd, char *local, char *remote, int printnames)
} }
closefunc = pclose; closefunc = pclose;
} else { } else {
fin = fopen (local, "r"); fin = fopen (local, lmode);
if (fin == NULL) { if (fin == NULL) {
warn ("local: %s", local); warn ("local: %s", local);
signal (SIGINT, oldintr); signal (SIGINT, oldintr);
@@ -720,7 +720,7 @@ sendrequest (char *cmd, char *local, char *remote, int printnames)
return; return;
} }
restart_point = 0; restart_point = 0;
lmode = "r+w"; rmode = "r+w";
} }
if (remote) { if (remote) {
if (command ("%s %s", cmd, remote) != PRELIM) { if (command ("%s %s", cmd, remote) != PRELIM) {
@@ -739,7 +739,7 @@ sendrequest (char *cmd, char *local, char *remote, int printnames)
(*closefunc)(fin); (*closefunc)(fin);
return; return;
} }
dout = dataconn(lmode); dout = dataconn(rmode);
if (dout == NULL) if (dout == NULL)
goto abort; goto abort;
set_buffer_size (fileno (dout), 0); set_buffer_size (fileno (dout), 0);