(in ruserpass.c, routine rnetrc()).
SCCS-vsn: usr.bin/ftp/main.c 5.6
SCCS-vsn: usr.bin/ftp/ftp.c 5.9
SCCS-vsn: usr.bin/ftp/ftp_var.h 5.3
SCCS-vsn: usr.bin/ftp/cmds.c 5.5
SCCS-vsn: usr.bin/ftp/domacro.c 1.2
SCCS-vsn: usr.bin/ftp/ruserpass.c 1.3
-static char sccsid[] = "@(#)cmds.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)cmds.c 5.5 (Berkeley) %G%";
#include <errno.h>
#include <netdb.h>
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#include <ctype.h>
return;
}
if (argc < 2) {
return;
}
if (argc < 2) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
if (host) {
connected = 1;
if (autologin)
if (host) {
connected = 1;
if (autologin)
else
comret = command("TYPE %s", p->t_mode);
if (comret == COMPLETE) {
else
comret = command("TYPE %s", p->t_mode);
if (comret == COMPLETE) {
- strcpy(typename, p->t_name);
+ (void) strcpy(typename, p->t_name);
/*
* Set file transfer mode.
*/
/*
* Set file transfer mode.
*/
setmode(argc, argv)
char *argv[];
{
setmode(argc, argv)
char *argv[];
{
/*
* Set file transfer format.
*/
/*
* Set file transfer format.
*/
setform(argc, argv)
char *argv[];
{
setform(argc, argv)
char *argv[];
{
/*
* Set file transfer structure.
*/
/*
* Set file transfer structure.
*/
setstruct(argc, argv)
char *argv[];
{
setstruct(argc, argv)
char *argv[];
{
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
return;
}
if (argc < 3) {
return;
}
if (argc < 3) {
+ (void) strcat(line, " ");
printf("(remote-file) ");
printf("(remote-file) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
char *tp;
if (argc < 2) {
char *tp;
if (argc < 2) {
+ (void) strcat(line, " ");
printf("(local-files) ");
printf("(local-files) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
if (proxy) {
char *cp, *tp2, tmpbuf[MAXPATHLEN];
if (proxy) {
char *cp, *tp2, tmpbuf[MAXPATHLEN];
- while ((cp = remglob(argc, argv, 0)) != NULL) {
+ while ((cp = remglob(argv,0)) != NULL) {
if (*cp == 0) {
mflag = 0;
continue;
if (*cp == 0) {
mflag = 0;
continue;
+ (void) strcat(line, " ");
printf("(remote-file) ");
printf("(remote-file) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
return;
}
if (argc < 3) {
return;
}
if (argc < 3) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
extern jmp_buf jabort;
if (argc < 2) {
extern jmp_buf jabort;
if (argc < 2) {
+ (void) strcat(line, " ");
printf("(remote-files) ");
printf("(remote-files) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
mflag = 1;
oldintr = signal(SIGINT,mabort);
(void) setjmp(jabort);
mflag = 1;
oldintr = signal(SIGINT,mabort);
(void) setjmp(jabort);
- while ((cp = remglob(argc, argv, proxy)) != NULL) {
+ while ((cp = remglob(argv,proxy)) != NULL) {
if (*cp == '\0') {
mflag = 0;
continue;
if (*cp == '\0') {
mflag = 0;
continue;
-remglob(argc, argv, doswitch)
- int argc, doswitch;
{
char temp[16];
static char buf[MAXPATHLEN];
{
char temp[16];
static char buf[MAXPATHLEN];
return (cp);
}
if (ftemp == NULL) {
return (cp);
}
if (ftemp == NULL) {
- strcpy(temp, "/tmp/ftpXXXXXX");
- mktemp(temp);
+ (void) strcpy(temp, "/tmp/ftpXXXXXX");
+ (void) mktemp(temp);
oldverbose = verbose, verbose = 0;
oldhash = hash, hash = 0;
if (doswitch) {
oldverbose = verbose, verbose = 0;
oldhash = hash, hash = 0;
if (doswitch) {
}
verbose = oldverbose; hash = oldhash;
ftemp = fopen(temp, "r");
}
verbose = oldverbose; hash = oldhash;
ftemp = fopen(temp, "r");
if (ftemp == NULL) {
printf("can't find list of remote files, oops\n");
return (NULL);
}
}
if (fgets(buf, sizeof (buf), ftemp) == NULL) {
if (ftemp == NULL) {
printf("can't find list of remote files, oops\n");
return (NULL);
}
}
if (fgets(buf, sizeof (buf), ftemp) == NULL) {
- fclose(ftemp), ftemp = NULL;
+ (void) fclose(ftemp), ftemp = NULL;
return (NULL);
}
if ((cp = index(buf, '\n')) != NULL)
return (NULL);
}
if ((cp = index(buf, '\n')) != NULL)
status(argc, argv)
char *argv[];
{
status(argc, argv)
char *argv[];
{
+ (void) strcat(line, " ");
printf("(remote-directory) ");
printf("(remote-directory) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
+ (void) strcat(line, " ");
printf("(remote-file) ");
printf("(remote-file) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
extern jmp_buf jabort;
if (argc < 2) {
extern jmp_buf jabort;
if (argc < 2) {
+ (void) strcat(line, " ");
printf("(remote-files) ");
printf("(remote-files) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
mflag = 1;
oldintr = signal(SIGINT, mabort);
(void) setjmp(jabort);
mflag = 1;
oldintr = signal(SIGINT, mabort);
(void) setjmp(jabort);
- while ((cp = remglob(argc, argv, 0)) != NULL) {
+ while ((cp = remglob(argv,0)) != NULL) {
if (*cp == '\0') {
mflag = 0;
continue;
if (*cp == '\0') {
mflag = 0;
continue;
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
return;
}
if (argc < 3) {
return;
}
if (argc < 3) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
extern jmp_buf jabort;
if (argc < 2) {
extern jmp_buf jabort;
if (argc < 2) {
+ (void) strcat(line, " ");
printf("(remote-files) ");
printf("(remote-files) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
}
if (argc < 3) {
makeargv();
argc = margc;
argv = margv;
}
if (argc < 3) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
/*
* Do a shell escape
*/
/*
* Do a shell escape
*/
shell(argc, argv)
char *argv[];
{
shell(argc, argv)
char *argv[];
{
- int i, pid, status, (*old1)(), (*old2)();
+ int pid, (*old1)(), (*old2)();
char shellnam[40], *shell, *namep;
char shellnam[40], *shell, *namep;
old1 = signal (SIGINT, SIG_IGN);
old2 = signal (SIGQUIT, SIG_IGN);
if ((pid = fork()) == 0) {
for (pid = 3; pid < 20; pid++)
old1 = signal (SIGINT, SIG_IGN);
old2 = signal (SIGQUIT, SIG_IGN);
if ((pid = fork()) == 0) {
for (pid = 3; pid < 20; pid++)
- close(pid);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
+ (void) close(pid);
+ (void) signal(SIGINT, SIG_DFL);
+ (void) signal(SIGQUIT, SIG_DFL);
shell = getenv("SHELL");
if (shell == NULL)
shell = "/bin/sh";
namep = rindex(shell,'/');
if (namep == NULL)
namep = shell;
shell = getenv("SHELL");
if (shell == NULL)
shell = "/bin/sh";
namep = rindex(shell,'/');
if (namep == NULL)
namep = shell;
- strcpy(shellnam,"-");
- strcat(shellnam, ++namep);
+ (void) strcpy(shellnam,"-");
+ (void) strcat(shellnam, ++namep);
if (strcmp(namep, "sh") != 0)
shellnam[0] = '+';
if (debug) {
printf ("%s\n", shell);
if (strcmp(namep, "sh") != 0)
shellnam[0] = '+';
if (debug) {
printf ("%s\n", shell);
+ (void) fflush (stdout);
}
if (argc > 1) {
execl(shell,shellnam,"-c",altarg,(char *)0);
}
if (argc > 1) {
execl(shell,shellnam,"-c",altarg,(char *)0);
if (pid > 0)
while (wait(&status) != pid)
;
if (pid > 0)
while (wait(&status) != pid)
;
- signal(SIGINT, old1);
- signal(SIGQUIT, old2);
+ (void) signal(SIGINT, old1);
+ (void) signal(SIGQUIT, old2);
if (pid == -1) {
perror("Try again later");
code = -1;
if (pid == -1) {
perror("Try again later");
code = -1;
- char acct[80], *getpass();
+ char acct[80], *mygetpass();
int n, aflag = 0;
if (argc < 2) {
int n, aflag = 0;
if (argc < 2) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
n = command("USER %s", argv[1]);
if (n == CONTINUE) {
if (argc < 3 )
n = command("USER %s", argv[1]);
if (n == CONTINUE) {
if (argc < 3 )
- argv[2] = getpass("Password: "), argc++;
+ argv[2] = mygetpass("Password: "), argc++;
n = command("PASS %s", argv[2]);
}
if (n == CONTINUE) {
n = command("PASS %s", argv[2]);
}
if (n == CONTINUE) {
aflag++;
}
if (n != COMPLETE) {
aflag++;
}
if (n != COMPLETE) {
- fprintf(stderr, "Login failed.\n");
+ fprintf(stdout, "Login failed.\n");
return (0);
}
if (!aflag && argc == 4) {
return (0);
}
if (!aflag && argc == 4) {
+ (void) strcat(line, " ");
printf("(directory-name) ");
printf("(directory-name) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
+ (void) strcat(line, " ");
printf("(directory-name) ");
printf("(directory-name) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
char buf[BUFSIZ];
if (argc < 2) {
char buf[BUFSIZ];
if (argc < 2) {
+ (void) strcat(line, " ");
printf("(command line to send) ");
printf("(command line to send) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
+ (void) strcpy(buf, argv[1]);
for (i = 2; i < argc; i++) {
for (i = 2; i < argc; i++) {
- strcat(buf, " ");
- strcat(buf, argv[i]);
+ (void) strcat(buf, " ");
+ (void) strcat(buf, argv[i]);
}
if (command(buf) == PRELIM) {
while (getreply(0) == PRELIM);
}
if (command(buf) == PRELIM) {
while (getreply(0) == PRELIM);
if (!interactive)
return (1);
printf("%s %s? ", cmd, file);
if (!interactive)
return (1);
printf("%s %s? ", cmd, file);
- fflush(stdout);
- gets(line);
+ (void) fflush(stdout);
+ (void) gets(line);
return (*line != 'n' && *line != 'N');
}
return (*line != 'n' && *line != 'N');
}
- fprintf(stderr, "ftp: %s\n");
+ fprintf(stderr, "ftp: %s\n", msg);
- char acct[50], *getpass(), *ap;
+ char acct[50], *mygetpass(), *ap;
- ap = getpass("Account:");
+ ap = mygetpass("Account:");
}
(void) command("ACCT %s", ap);
}
}
(void) command("ACCT %s", ap);
}
extern jmp_buf abortprox;
if (argc < 2) {
extern jmp_buf abortprox;
if (argc < 2) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
c = getcmd(argv[1]);
if (c == (struct cmd *) -1) {
printf("?Ambiguous command\n");
c = getcmd(argv[1]);
if (c == (struct cmd *) -1) {
printf("?Ambiguous command\n");
code = -1;
return;
}
if (c == 0) {
printf("?Invalid command\n");
code = -1;
return;
}
if (c == 0) {
printf("?Invalid command\n");
code = -1;
return;
}
if (!c->c_proxy) {
printf("?Invalid proxy command\n");
code = -1;
return;
}
if (!c->c_proxy) {
printf("?Invalid proxy command\n");
pswitch(1);
if (c->c_conn && !connected) {
printf("Not connected\n");
pswitch(1);
if (c->c_conn && !connected) {
printf("Not connected\n");
pswitch(0);
(void) signal(SIGINT, oldintr);
code = -1;
pswitch(0);
(void) signal(SIGINT, oldintr);
code = -1;
return;
}
if (argc < 3) {
return;
}
if (argc < 3) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
return;
}
if (argc < 2) {
return;
}
if (argc < 2) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
if (interactive) {
printf("Enter macro line by line, terminating it with a null line\n");
}
if (interactive) {
printf("Enter macro line by line, terminating it with a null line\n");
}
- strncpy(macros[macnum].mac_name, argv[1], 8);
+ (void) strncpy(macros[macnum].mac_name, argv[1], 8);
if (macnum == 0) {
macros[macnum].mac_start = macbuf;
}
if (macnum == 0) {
macros[macnum].mac_start = macbuf;
}
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
-static char sccsid[] = "@(#)domacro.c 1.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)domacro.c 1.2 (Berkeley) %G%";
#endif not lint
#include "ftp_var.h"
#endif not lint
#include "ftp_var.h"
#include <ctype.h>
#include <sys/ttychars.h>
#include <ctype.h>
#include <sys/ttychars.h>
domacro(argc, argv)
int argc;
char *argv[];
{
register int i, j;
register char *cp1, *cp2;
domacro(argc, argv)
int argc;
char *argv[];
{
register int i, j;
register char *cp1, *cp2;
- int count = 2, loopflg = 0, (*oldintr)();
- char **gargs, **cpp, line2[200];
+ int count = 2, loopflg = 0;
+ char line2[200];
extern char **glob(), *globerr;
struct cmd *getcmd(), *c;
extern struct cmd cmdtab[];
if (argc < 2) {
extern char **glob(), *globerr;
struct cmd *getcmd(), *c;
extern struct cmd cmdtab[];
if (argc < 2) {
+ (void) strcat(line, " ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
+ (void) strcpy(line2, line);
TOP:
cp1 = macros[i].mac_start;
while (cp1 != macros[i].mac_end) {
TOP:
cp1 = macros[i].mac_start;
while (cp1 != macros[i].mac_end) {
}
cp1--;
if (argc - 2 >= j) {
}
cp1--;
if (argc - 2 >= j) {
- strcpy(cp2, argv[j+1]);
+ (void) strcpy(cp2, argv[j+1]);
cp2 += strlen(argv[j+1]);
}
break;
cp2 += strlen(argv[j+1]);
}
break;
loopflg = 1;
cp1++;
if (count < argc) {
loopflg = 1;
cp1++;
if (count < argc) {
- strcpy(cp2, argv[count]);
+ (void) strcpy(cp2, argv[count]);
cp2 += strlen(argv[count]);
}
break;
cp2 += strlen(argv[count]);
}
break;
}
(*c->c_handler)(margc, margv);
if (bell && c->c_bell) {
}
(*c->c_handler)(margc, margv);
if (bell && c->c_bell) {
+ (void) putchar(CTRL(g));
+ (void) strcpy(line, line2);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
-static char sccsid[] = "@(#)ftp.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftp.c 5.9 (Berkeley) %G%";
#endif not lint
#include "ftp_var.h"
#endif not lint
#include "ftp_var.h"
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/ftp.h>
#include <netinet/in.h>
#include <arpa/ftp.h>
int ptflag = 0;
int connected;
struct sockaddr_in myctladdr;
int ptflag = 0;
int connected;
struct sockaddr_in myctladdr;
FILE *cin, *cout;
FILE *dataconn();
FILE *cin, *cout;
FILE *dataconn();
return (0);
}
hisctladdr.sin_port = port;
return (0);
}
hisctladdr.sin_port = port;
- while (connect(s, (caddr_t)&hisctladdr, sizeof (hisctladdr)) < 0) {
+ while (connect(s, &hisctladdr, sizeof (hisctladdr)) < 0) {
if (hp && hp->h_addr_list[1]) {
int oerrno = errno;
fprintf(stderr, "ftp: connect to address %s: ",
inet_ntoa(hisctladdr.sin_addr));
errno = oerrno;
if (hp && hp->h_addr_list[1]) {
int oerrno = errno;
fprintf(stderr, "ftp: connect to address %s: ",
inet_ntoa(hisctladdr.sin_addr));
errno = oerrno;
hp->h_addr_list++;
bcopy(hp->h_addr_list[0],
(caddr_t)&hisctladdr.sin_addr, hp->h_length);
hp->h_addr_list++;
bcopy(hp->h_addr_list[0],
(caddr_t)&hisctladdr.sin_addr, hp->h_length);
- fprintf(stderr, "Trying %s...\n",
+ fprintf(stdout, "Trying %s...\n",
inet_ntoa(hisctladdr.sin_addr));
continue;
}
inet_ntoa(hisctladdr.sin_addr));
continue;
}
if (cin == NULL || cout == NULL) {
fprintf(stderr, "ftp: fdopen failed.\n");
if (cin)
if (cin == NULL || cout == NULL) {
fprintf(stderr, "ftp: fdopen failed.\n");
if (cin)
printf("Connected to %s.\n", hostname);
if (getreply(0) != 2) { /* read startup message from server */
if (cin)
printf("Connected to %s.\n", hostname);
if (getreply(0) != 2) { /* read startup message from server */
if (cin)
verbose = oldverbose;
return (hostname);
bad:
verbose = oldverbose;
return (hostname);
bad:
char *host;
{
char tmp[80];
char *host;
{
char tmp[80];
- char *user, *pass, *acct, *getlogin(), *getpass();
+ char *user, *pass, *acct, *getlogin(), *mygetpass();
int n, aflag = 0;
user = pass = acct = 0;
int n, aflag = 0;
user = pass = acct = 0;
n = command("USER %s", user);
if (n == CONTINUE) {
if (pass == NULL)
n = command("USER %s", user);
if (n == CONTINUE) {
if (pass == NULL)
- pass = getpass("Password:");
+ pass = mygetpass("Password:");
n = command("PASS %s", pass);
}
if (n == CONTINUE) {
aflag++;
n = command("PASS %s", pass);
}
if (n == CONTINUE) {
aflag++;
- acct = getpass("Account:");
+ acct = mygetpass("Account:");
n = command("ACCT %s", acct);
}
if (n != COMPLETE) {
n = command("ACCT %s", acct);
}
if (n != COMPLETE) {
return(1);
for (n = 0; n < macnum; ++n) {
if (!strcmp("init", macros[n].mac_name)) {
return(1);
for (n = 0; n < macnum; ++n) {
if (!strcmp("init", macros[n].mac_name)) {
+ (void) strcpy(line, "$init");
makeargv();
domacro(margc, margv);
break;
makeargv();
domacro(margc, margv);
break;
command(fmt, args)
char *fmt;
{
command(fmt, args)
char *fmt;
{
if (proxflag &&
(dig == 1 || dig == 5 && verbose == 0))
printf("%s:",hostname);
if (proxflag &&
(dig == 1 || dig == 5 && verbose == 0))
printf("%s:",hostname);
}
if (dig < 4 && isdigit(c))
code = code * 10 + (c - '0');
}
if (dig < 4 && isdigit(c))
code = code * 10 + (c - '0');
n = c;
}
if (verbose > 0 || verbose > -1 && n == '5') {
n = c;
}
if (verbose > 0 || verbose > -1 && n == '5') {
(void) fflush (stdout);
}
if (continuation && code != originalcode) {
(void) fflush (stdout);
}
if (continuation && code != originalcode) {
int sec;
{
struct timeval t;
t.tv_sec = (long) sec;
t.tv_usec = 0;
int sec;
{
struct timeval t;
t.tv_sec = (long) sec;
t.tv_usec = 0;
- if (select(20, &mask, 0, 0, &t) < 0)
+ if (select(20, &mask, (struct fd_set *) 0, (struct fd_set *) 0, &t) < 0)
sendrequest(cmd, local, remote)
char *cmd, *local, *remote;
{
sendrequest(cmd, local, remote)
char *cmd, *local, *remote;
{
- FILE *fin, *dout = 0, *popen();
- int (*closefunc)(), pclose(), fclose(), (*oldintr)(), (*oldintp)();
+ FILE *fin, *dout = 0, *mypopen();
+ int (*closefunc)(), mypclose(), fclose(), (*oldintr)(), (*oldintp)();
int abortsend();
char buf[BUFSIZ];
long bytes = 0, hashbytes = sizeof (buf);
int abortsend();
char buf[BUFSIZ];
long bytes = 0, hashbytes = sizeof (buf);
fin = stdin;
else if (*local == '|') {
oldintp = signal(SIGPIPE,SIG_IGN);
fin = stdin;
else if (*local == '|') {
oldintp = signal(SIGPIPE,SIG_IGN);
- fin = popen(local + 1, "r");
+ fin = mypopen(local + 1, "r");
if (fin == NULL) {
perror(local + 1);
(void) signal(SIGINT, oldintr);
if (fin == NULL) {
perror(local + 1);
(void) signal(SIGINT, oldintr);
} else {
fin = fopen(local, "r");
if (fin == NULL) {
} else {
fin = fopen(local, "r");
if (fin == NULL) {
closefunc = fclose;
if (fstat(fileno(fin), &st) < 0 ||
(st.st_mode&S_IFMT) != S_IFREG) {
closefunc = fclose;
if (fstat(fileno(fin), &st) < 0 ||
(st.st_mode&S_IFMT) != S_IFREG) {
- fprintf(stderr, "%s: not a plain file.\n", local);
+ fprintf(stdout, "%s: not a plain file.\n", local);
(void) signal(SIGINT, oldintr);
code = -1;
return;
(void) signal(SIGINT, oldintr);
code = -1;
return;
dout = dataconn("w");
if (dout == NULL)
goto abort;
dout = dataconn("w");
if (dout == NULL)
goto abort;
- gettimeofday(&start, (struct timezone *)0);
+ (void) gettimeofday(&start, (struct timezone *)0);
switch (type) {
case TYPE_I:
switch (type) {
case TYPE_I:
break;
bytes += c;
if (hash) {
break;
bytes += c;
if (hash) {
- putchar('#');
- fflush(stdout);
+ (void) putchar('#');
+ (void) fflush(stdout);
}
}
if (hash && bytes > 0) {
}
}
if (hash && bytes > 0) {
- putchar('\n');
- fflush(stdout);
+ (void) putchar('\n');
+ (void) fflush(stdout);
}
if (c < 0)
perror(local);
}
if (c < 0)
perror(local);
while ((c = getc(fin)) != EOF) {
if (c == '\n') {
while (hash && (bytes >= hashbytes)) {
while ((c = getc(fin)) != EOF) {
if (c == '\n') {
while (hash && (bytes >= hashbytes)) {
- putchar('#');
- fflush(stdout);
+ (void) putchar('#');
+ (void) fflush(stdout);
hashbytes += sizeof (buf);
}
if (ferror(dout))
break;
hashbytes += sizeof (buf);
}
if (ferror(dout))
break;
+ (void) putc('\r', dout);
bytes++;
/* if (c == '\r') { */
bytes++;
/* if (c == '\r') { */
- /* putc('\0', dout); /* this violates rfc */
+ /* (void) putc('\0', dout); /* this violates rfc */
/* bytes++; */
/* } */
}
if (hash) {
if (bytes < hashbytes)
/* bytes++; */
/* } */
}
if (hash) {
if (bytes < hashbytes)
- putchar('#');
- putchar('\n');
- fflush(stdout);
+ (void) putchar('#');
+ (void) putchar('\n');
+ (void) fflush(stdout);
}
if (ferror(fin))
perror(local);
}
if (ferror(fin))
perror(local);
perror("netout");
break;
}
perror("netout");
break;
}
- gettimeofday(&stop, (struct timezone *)0);
+ (void) gettimeofday(&stop, (struct timezone *)0);
if (closefunc != NULL)
(*closefunc)(fin);
(void) fclose(dout);
if (closefunc != NULL)
(*closefunc)(fin);
(void) fclose(dout);
ptransfer("sent", bytes, &start, &stop, local, remote);
return;
abort:
ptransfer("sent", bytes, &start, &stop, local, remote);
return;
abort:
- gettimeofday(&stop, (struct timezone *)0);
+ (void) gettimeofday(&stop, (struct timezone *)0);
(void) signal(SIGINT, oldintr);
if (oldintp)
(void) signal(SIGPIPE, oldintp);
(void) signal(SIGINT, oldintr);
if (oldintp)
(void) signal(SIGPIPE, oldintp);
recvrequest(cmd, local, remote, mode)
char *cmd, *local, *remote, *mode;
{
recvrequest(cmd, local, remote, mode)
char *cmd, *local, *remote, *mode;
{
- FILE *fout, *din = 0, *popen();
- int (*closefunc)(), pclose(), fclose(), (*oldintr)(), (*oldintp)();
+ FILE *fout, *din = 0, *mypopen();
+ int (*closefunc)(), mypclose(), fclose(), (*oldintr)(), (*oldintp)();
int abortrecv(), oldverbose, oldtype = 0, tcrflag;
char buf[BUFSIZ], *gunique();
int abortrecv(), oldverbose, oldtype = 0, tcrflag;
char buf[BUFSIZ], *gunique();
- long bytes = 0, hashbytes = sizeof (buf), mask;
+ long bytes = 0, hashbytes = sizeof (buf);
+ struct fd_set mask;
register int c, d;
struct timeval start, stop;
register int c, d;
struct timeval start, stop;
fout = stdout;
else if (*local == '|') {
oldintp = signal(SIGPIPE, SIG_IGN);
fout = stdout;
else if (*local == '|') {
oldintp = signal(SIGPIPE, SIG_IGN);
- fout = popen(local + 1, "w");
+ fout = mypopen(local + 1, "w");
if (fout == NULL) {
perror(local+1);
goto abort;
}
if (fout == NULL) {
perror(local+1);
goto abort;
}
}
else {
fout = fopen(local, mode);
}
else {
fout = fopen(local, mode);
- gettimeofday(&start, (struct timezone *)0);
+ (void) gettimeofday(&start, (struct timezone *)0);
switch (type) {
case TYPE_I:
switch (type) {
case TYPE_I:
break;
bytes += c;
if (hash) {
break;
bytes += c;
if (hash) {
- putchar('#');
- fflush(stdout);
+ (void) putchar('#');
+ (void) fflush(stdout);
}
}
if (hash && bytes > 0) {
}
}
if (hash && bytes > 0) {
- putchar('\n');
- fflush(stdout);
+ (void) putchar('\n');
+ (void) fflush(stdout);
}
if (c < 0)
perror("netin");
}
if (c < 0)
perror("netin");
while ((c = getc(din)) != EOF) {
if (c == '\r') {
while (hash && (bytes >= hashbytes)) {
while ((c = getc(din)) != EOF) {
if (c == '\r') {
while (hash && (bytes >= hashbytes)) {
- putchar('#');
- fflush(stdout);
+ (void) putchar('#');
+ (void) fflush(stdout);
hashbytes += sizeof (buf);
}
bytes++;
if ((c = getc(din)) != '\n' || tcrflag) {
if (ferror (fout))
break;
hashbytes += sizeof (buf);
}
bytes++;
if ((c = getc(din)) != '\n' || tcrflag) {
if (ferror (fout))
break;
+ (void) putc ('\r', fout);
}
/*if (c == '\0') {
bytes++;
continue;
}*/
}
}
/*if (c == '\0') {
bytes++;
continue;
}*/
}
bytes++;
}
if (hash) {
if (bytes < hashbytes)
bytes++;
}
if (hash) {
if (bytes < hashbytes)
- putchar('#');
- putchar('\n');
- fflush(stdout);
+ (void) putchar('#');
+ (void) putchar('\n');
+ (void) fflush(stdout);
}
if (ferror (din))
perror ("netin");
}
if (ferror (din))
perror ("netin");
}
if (closefunc != NULL)
(*closefunc)(fout);
}
if (closefunc != NULL)
(*closefunc)(fout);
- signal(SIGINT, oldintr);
+ (void) signal(SIGINT, oldintr);
if (oldintp)
(void) signal(SIGPIPE, oldintp);
if (oldintp)
(void) signal(SIGPIPE, oldintp);
- gettimeofday(&stop, (struct timezone *)0);
+ (void) gettimeofday(&stop, (struct timezone *)0);
(void) fclose(din);
(void) getreply(0);
if (bytes > 0 && verbose)
(void) fclose(din);
(void) getreply(0);
if (bytes > 0 && verbose)
/* if server command parser understands TELNET commands, abort using */
/* recommended IP,SYNC sequence */
/* if server command parser understands TELNET commands, abort using */
/* recommended IP,SYNC sequence */
- gettimeofday(&stop, (struct timezone *)0);
+ (void) gettimeofday(&stop, (struct timezone *)0);
if (oldintp)
(void) signal(SIGPIPE, oldintr);
(void) signal(SIGINT,SIG_IGN);
if (oldintp)
(void) signal(SIGPIPE, oldintr);
(void) signal(SIGINT,SIG_IGN);
}
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
}
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
- mask = (1 << fileno(cin)) | (din ? (1 << fileno(din)) : 0);
- if ((mask = empty(mask,10)) < 0) {
+ FD_ZERO((char *) &mask);
+ FD_SET(fileno(cin), &mask);
+ if (din) {
+ FD_SET(fileno(din), &mask);
+ }
+ if (empty(mask,10) < 0) {
perror("abort");
code = -1;
lostpeer();
}
perror("abort");
code = -1;
lostpeer();
}
- if (din && mask & (1 << fileno(din)))
+ if (din && FD_ISSET(fileno(din), &mask)) {
while ((c = read(fileno(din), buf, sizeof (buf))) > 0)
;
while ((c = read(fileno(din), buf, sizeof (buf))) > 0)
;
if ((c = getreply(0)) == ERROR) { /* needed for nic style abort */
if (data >= 0) {
if ((c = getreply(0)) == ERROR) { /* needed for nic style abort */
if (data >= 0) {
data = -1;
}
(void) getreply(0);
data = -1;
}
(void) getreply(0);
{
register char *p, *a;
int result, len, tmpno = 0;
{
register char *p, *a;
int result, len, tmpno = 0;
noport:
data_addr = myctladdr;
noport:
data_addr = myctladdr;
perror("ftp: setsockopt (resuse address)");
goto bad;
}
perror("ftp: setsockopt (resuse address)");
goto bad;
}
- if (bind(data, (char *)&data_addr, sizeof (data_addr), 0) < 0) {
+ if (bind(data, (struct sockaddr *)&data_addr, sizeof (data_addr)) < 0) {
perror("ftp: bind");
goto bad;
}
perror("ftp: bind");
goto bad;
}
struct sockaddr_in from;
int s, fromlen = sizeof (from);
struct sockaddr_in from;
int s, fromlen = sizeof (from);
- s = accept(data, &from, &fromlen, 0);
+ s = accept(data, (struct sockaddr *) &from, &fromlen);
if (s < 0) {
perror("ftp: accept");
(void) close(data), data = -1;
if (s < 0) {
perror("ftp: accept");
(void) close(data), data = -1;
bytes, direction, s, bs / 1024.);
}
bytes, direction, s, bs / 1024.);
}
struct timeval *tsum, *t0;
{
struct timeval *tsum, *t0;
{
tsum->tv_usec += t0->tv_usec;
if (tsum->tv_usec > 1000000)
tsum->tv_sec++, tsum->tv_usec -= 1000000;
tsum->tv_usec += t0->tv_usec;
if (tsum->tv_usec > 1000000)
tsum->tv_sec++, tsum->tv_usec -= 1000000;
tvsub(tdiff, t1, t0)
struct timeval *tdiff, *t1, *t0;
tvsub(tdiff, t1, t0)
struct timeval *tdiff, *t1, *t0;
}
ip->connect = connected;
connected = op->connect;
}
ip->connect = connected;
connected = op->connect;
- strncpy(ip->name, hostname, 31);
+ (void) strncpy(ip->name, hostname, 31);
(ip->name)[strlen(ip->name)] = '\0';
hostname = op->name;
ip->hctl = hisctladdr;
(ip->name)[strlen(ip->name)] = '\0';
hostname = op->name;
ip->hctl = hisctladdr;
mcase = op->mcse;
ip->ntflg = ntflag;
ntflag = op->ntflg;
mcase = op->mcse;
ip->ntflg = ntflag;
ntflag = op->ntflg;
- strncpy(ip->nti, ntin, 16);
+ (void) strncpy(ip->nti, ntin, 16);
(ip->nti)[strlen(ip->nti)] = '\0';
(ip->nti)[strlen(ip->nti)] = '\0';
- strcpy(ntin, op->nti);
- strncpy(ip->nto, ntout, 16);
+ (void) strcpy(ntin, op->nti);
+ (void) strncpy(ip->nto, ntout, 16);
(ip->nto)[strlen(ip->nto)] = '\0';
(ip->nto)[strlen(ip->nto)] = '\0';
- strcpy(ntout, op->nto);
+ (void) strcpy(ntout, op->nto);
ip->mapflg = mapflag;
mapflag = op->mapflg;
ip->mapflg = mapflag;
mapflag = op->mapflg;
- strncpy(ip->mi, mapin, MAXPATHLEN - 1);
+ (void) strncpy(ip->mi, mapin, MAXPATHLEN - 1);
(ip->mi)[strlen(ip->mi)] = '\0';
(ip->mi)[strlen(ip->mi)] = '\0';
- strcpy(mapin, op->mi);
- strncpy(ip->mo, mapout, MAXPATHLEN - 1);
+ (void) strcpy(mapin, op->mi);
+ (void) strncpy(ip->mo, mapout, MAXPATHLEN - 1);
(ip->mo)[strlen(ip->mo)] = '\0';
(ip->mo)[strlen(ip->mo)] = '\0';
- strcpy(mapout, op->mo);
+ (void) strcpy(mapout, op->mo);
(void) signal(SIGINT, oldintr);
if (abrtflag) {
abrtflag = 0;
(void) signal(SIGINT, oldintr);
if (abrtflag) {
abrtflag = 0;
abortpt()
{
printf("\n");
abortpt()
{
printf("\n");
ptabflg++;
mflag = 0;
abrtflag = 0;
ptabflg++;
mflag = 0;
abrtflag = 0;
int (*oldintr)(), abortpt(), tmptype, oldtype = 0, secndflag = 0;
extern jmp_buf ptabort;
char *cmd2;
int (*oldintr)(), abortpt(), tmptype, oldtype = 0, secndflag = 0;
extern jmp_buf ptabort;
char *cmd2;
if (strcmp(cmd, "RETR"))
cmd2 = "RETR";
if (strcmp(cmd, "RETR"))
cmd2 = "RETR";
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
- mask = 1 << fileno(cin);
- if ((mask = empty(mask,10)) < 0) {
+ FD_ZERO((char *) &mask);
+ FD_SET(fileno(cin), &mask);
+ if (empty(mask,10) < 0) {
perror("abort");
if (ptabflg)
code = -1;
perror("abort");
if (ptabflg)
code = -1;
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
- mask = 1 << fileno(cin);
- if ((mask = empty(mask,10)) < 0) {
+ FD_ZERO((char *) &mask);
+ FD_SET(fileno(cin), &mask);
+ if ((empty(mask,10)) < 0) {
perror("abort");
if (ptabflg)
code = -1;
perror("abort");
if (ptabflg)
code = -1;
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
- mask = 1 << fileno(cin);
- if ((mask = empty(mask,10)) < 0) {
+ FD_ZERO((char *) &mask);
+ FD_SET(fileno(cin), &mask);
+ if (empty(mask,10) < 0) {
perror("abort");
if (ptabflg)
code = -1;
perror("abort");
if (ptabflg)
code = -1;
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
if (cpend) {
fprintf(cout,"ABOR\r\n");
(void) fflush(cout);
- mask = 1 << fileno(cin);
- if ((mask = empty(mask,10)) < 0) {
+ FD_ZERO((char *) &mask);
+ FD_SET(fileno(cin), &mask);
+ if (empty(mask,10) < 0) {
perror("abort");
if (ptabflg)
code = -1;
perror("abort");
if (ptabflg)
code = -1;
}
pswitch(!proxy);
if (cpend) {
}
pswitch(!proxy);
if (cpend) {
- mask = 1 << fileno(cin);
- if ((mask = empty(mask,10)) < 0) {
+ FD_ZERO((char *) &mask);
+ FD_SET(fileno(cin), &mask);
+ if (empty(mask,10) < 0) {
perror("abort");
if (ptabflg)
code = -1;
perror("abort");
if (ptabflg)
code = -1;
+ struct fd_set mask;
+ int nfnd = 1;
- mask = 1 << fileno(cin);
- while (mask > 0) {
- if ((mask = empty(mask,0)) < 0) {
+ FD_ZERO((char *) &mask);
+ while (nfnd) {
+ FD_SET(fileno(cin), &mask);
+ if ((nfnd = empty(mask,0)) < 0) {
perror("reset");
code = -1;
lostpeer();
}
perror("reset");
code = -1;
lostpeer();
}
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)ftp_var.h 5.2 (Berkeley) %G%
+ * @(#)ftp_var.h 5.3 (Berkeley) %G%
int ntflag; /* use ntin ntout tables for name translation */
int mapflag; /* use mapin mapout templates on file names */
int code; /* return/reply code for ftp command */
int ntflag; /* use ntin ntout tables for name translation */
int mapflag; /* use mapin mapout templates on file names */
int code; /* return/reply code for ftp command */
-int macroflg; /* active macro */
int crflag; /* if 1, strip car. rets. on ascii gets */
char pasv[64]; /* passive port for proxy data connection */
char *altarg; /* argv[1] with no shell-like preprocessing */
int crflag; /* if 1, strip car. rets. on ascii gets */
char pasv[64]; /* passive port for proxy data connection */
char *altarg; /* argv[1] with no shell-like preprocessing */
};
int macnum; /* number of defined macros */
};
int macnum; /* number of defined macros */
-struct macel macros[16], *macpt;
+struct macel macros[16];
char macbuf[4096];
extern char *tail();
char macbuf[4096];
extern char *tail();
extern char *rindex();
extern char *remglob();
extern int errno;
extern char *rindex();
extern char *remglob();
extern int errno;
+extern char *mktemp();
+extern char *strncpy();
+extern char *strncat();
+extern char *strcat();
+extern char *strcpy();
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.6 (Berkeley) %G%";
#include "ftp_var.h"
#include <sys/socket.h>
#include <sys/ioctl.h>
#include "ftp_var.h"
#include <sys/socket.h>
#include <sys/ioctl.h>
int intr();
int lostpeer();
extern char *home;
int intr();
int lostpeer();
extern char *home;
"ftp: %c: unknown option\n", *cp);
exit(1);
}
"ftp: %c: unknown option\n", *cp);
exit(1);
}
/*
* Set up defaults for FTP.
*/
/*
* Set up defaults for FTP.
*/
- strcpy(typename, "ascii"), type = TYPE_A;
- strcpy(formname, "non-print"), form = FORM_N;
- strcpy(modename, "stream"), mode = MODE_S;
- strcpy(structname, "file"), stru = STRU_F;
- strcpy(bytename, "8"), bytesize = 8;
+ (void) strcpy(typename, "ascii"), type = TYPE_A;
+ (void) strcpy(formname, "non-print"), form = FORM_N;
+ (void) strcpy(modename, "stream"), mode = MODE_S;
+ (void) strcpy(structname, "file"), stru = STRU_F;
+ (void) strcpy(bytename, "8"), bytesize = 8;
if (fromatty)
verbose++;
cpend = 0; /* no pending replies */
if (fromatty)
verbose++;
cpend = 0; /* no pending replies */
pw = getpwuid(getuid());
if (pw != NULL) {
home = homedir;
pw = getpwuid(getuid());
if (pw != NULL) {
home = homedir;
- strcpy(home, pw->pw_dir);
+ (void) strcpy(home, pw->pw_dir);
}
if (argc > 0) {
if (setjmp(toplevel))
exit(0);
}
if (argc > 0) {
if (setjmp(toplevel))
exit(0);
- signal(SIGINT, intr);
- signal(SIGPIPE, lostpeer);
+ (void) signal(SIGINT, intr);
+ (void) signal(SIGPIPE, lostpeer);
setpeer(argc + 1, argv - 1);
}
top = setjmp(toplevel) == 0;
if (top) {
setpeer(argc + 1, argv - 1);
}
top = setjmp(toplevel) == 0;
if (top) {
- signal(SIGINT, intr);
- signal(SIGPIPE, lostpeer);
+ (void) signal(SIGINT, intr);
+ (void) signal(SIGPIPE, lostpeer);
}
for (;;) {
cmdscanner(top);
}
for (;;) {
cmdscanner(top);
if (connected) {
if (cout != NULL) {
if (connected) {
if (cout != NULL) {
- shutdown(fileno(cout), 1+1);
- fclose(cout);
+ (void) shutdown(fileno(cout), 1+1);
+ (void) fclose(cout);
cout = NULL;
}
if (data >= 0) {
cout = NULL;
}
if (data >= 0) {
+ (void) shutdown(data, 1+1);
(void) close(data);
data = -1;
}
(void) close(data);
data = -1;
}
pswitch(1);
if (connected) {
if (cout != NULL) {
pswitch(1);
if (connected) {
if (cout != NULL) {
- shutdown(fileno(cout), 1+1);
- fclose(cout);
+ (void) shutdown(fileno(cout), 1+1);
+ (void) fclose(cout);
cout = NULL;
}
connected = 0;
cout = NULL;
}
connected = 0;
tail(filename)
char *filename;
{
tail(filename)
char *filename;
{
extern int help();
if (!top)
extern int help();
if (!top)
for (;;) {
if (fromatty) {
printf("ftp> ");
for (;;) {
if (fromatty) {
printf("ftp> ");
}
if (gets(line) == 0) {
if (feof(stdin))
}
if (gets(line) == 0) {
if (feof(stdin))
}
(*c->c_handler)(margc, margv);
if (bell && c->c_bell)
}
(*c->c_handler)(margc, margv);
if (bell && c->c_bell)
+ (void) putchar(CTRL(g));
if (c->c_handler != help)
break;
}
if (c->c_handler != help)
break;
}
- signal(SIGINT, intr);
- signal(SIGPIPE, lostpeer);
+ (void) signal(SIGINT, intr);
+ (void) signal(SIGPIPE, lostpeer);
}
else if (c->c_name) {
for (k=0; k < strlen(c->c_name); k++) {
}
else if (c->c_name) {
for (k=0; k < strlen(c->c_name); k++) {
}
}
if (c + lines >= &cmdtab[NCMDS]) {
}
}
if (c + lines >= &cmdtab[NCMDS]) {
w = strlen(c->c_name);
while (w < width) {
w = (w + 8) &~ 7;
w = strlen(c->c_name);
while (w < width) {
w = (w + 8) &~ 7;
/*
* Call routine with argc, argv set from args (terminated by 0).
*/
/*
* Call routine with argc, argv set from args (terminated by 0).
*/
call(routine, args)
int (*routine)();
int args;
call(routine, args)
int (*routine)();
int args;
-static char sccsid[] = "@(#)ruserpass.c 1.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)ruserpass.c 1.3 (Berkeley) %G%";
#include <errno.h>
char *renvlook(), *malloc(), *index(), *getenv(), *getpass(), *getlogin();
#include <errno.h>
char *renvlook(), *malloc(), *index(), *getenv(), *getpass(), *getlogin();
struct utmp *getutmp();
static FILE *cfile;
struct utmp *getutmp();
static FILE *cfile;
rnetrc(host, aname, apass, aacct)
char *host, **aname, **apass, **aacct;
{
rnetrc(host, aname, apass, aacct)
char *host, **aname, **apass, **aacct;
{
- char *hdir, buf[BUFSIZ], *tmp, c;
- int t, i;
+ char *hdir, buf[BUFSIZ], *tmp;
+ int t, i, c;
struct stat stb;
extern int errno;
hdir = getenv("HOME");
if (hdir == NULL)
hdir = ".";
struct stat stb;
extern int errno;
hdir = getenv("HOME");
if (hdir == NULL)
hdir = ".";
- sprintf(buf, "%s/.netrc", hdir);
+ (void) sprintf(buf, "%s/.netrc", hdir);
cfile = fopen(buf, "r");
if (cfile == NULL) {
if (errno != ENOENT)
cfile = fopen(buf, "r");
if (cfile == NULL) {
if (errno != ENOENT)
case LOGIN:
if (token())
if (*aname == 0) {
case LOGIN:
if (token())
if (*aname == 0) {
- *aname = malloc(strlen(tokval) + 1);
- strcpy(*aname, tokval);
+ *aname = malloc((unsigned) strlen(tokval) + 1);
+ (void) strcpy(*aname, tokval);
} else {
if (strcmp(*aname, tokval))
goto next;
} else {
if (strcmp(*aname, tokval))
goto next;
return(-1);
}
if (token() && *apass == 0) {
return(-1);
}
if (token() && *apass == 0) {
- *apass = malloc(strlen(tokval) + 1);
- strcpy(*apass, tokval);
+ *apass = malloc((unsigned) strlen(tokval) + 1);
+ (void) strcpy(*apass, tokval);
return(-1);
}
if (token() && *aacct == 0) {
return(-1);
}
if (token() && *aacct == 0) {
- *aacct = malloc(strlen(tokval) + 1);
- strcpy(*aacct, tokval);
+ *aacct = malloc((unsigned) strlen(tokval) + 1);
+ (void) strcpy(*aacct, tokval);
+ (void) fclose(cfile);
+ return(0);