1 /* other.c Copyright 1992-2000 by Michael Temari All Rights Reserved
3 * ftp An ftp client program for use with TNET.
5 * Author: Michael Temari, <Michael@TemWare.Com>
19 _PROTOTYPE(static int docmdargs
, (char *cmd
, int fa
));
36 struct termios oldtty
, newtty
;
41 printf("You must \"OPEN\" a connection first.\n");
51 tcgetattr(fileno(stdout
), &oldtty
);
53 newtty
.c_lflag
&= ~ECHO
;
54 tcsetattr(fileno(stdout
), TCSANOW
, &newtty
);
56 s
= readline("Password: ", password
, sizeof(password
));
58 tcsetattr(fileno(stdout
), TCSANOW
, &oldtty
);
67 s
= DOcommand("PASS", pass
);
82 printf("You must \"OPEN\" a connection first.\n");
93 if(readline("Username: ", username
, sizeof(username
)) < 0)
98 s
= DOcommand("USER", user
);
100 if(atty
&& s
== 331) {
101 cmdargv
[0] = "password";
117 return(DOcommand("NOOP", ""));
122 passive
= 1 - passive
;
124 printf("Passive mode is now %s\n", (passive
? "ON" : "OFF"));
134 return(DOcommand("SYST", ""));
140 printf("You must \"OPEN\" a connection first.\n");
144 return(DOcommand("HELP", ""));
147 static int docmdargs(cmd
, fa
)
152 static char args
[512];
156 for(i
= fa
; i
< cmdargc
; i
++) {
159 strcat(args
, cmdargv
[i
]);
162 return(DOcommand(cmd
, args
));
167 return(docmdargs(cmdargv
[1], 2));
172 return(docmdargs("SITE", 1));