what signal(3)'s prototype says (and cast when not).
Also change MAXFOO+1 -> MAXFOO since MAXFOO includes the NULL.
Support $TMPDIR and use utime(3) not utimes(2) for portability's sake.
Don't spew "Passive mode enabled/disabled" unless verbose (this means
togglevar() needs to watch for a NULL 'message').
-/* $OpenBSD: cmds.c,v 1.14 1997/02/03 01:05:33 millert Exp $ */
+/* $OpenBSD: cmds.c,v 1.15 1997/02/05 04:55:12 millert Exp $ */
/* $NetBSD: cmds.c,v 1.18 1997/02/01 10:44:54 lukem Exp $ */
/*
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: cmds.c,v 1.14 1997/02/03 01:05:33 millert Exp $";
+static char rcsid[] = "$OpenBSD: cmds.c,v 1.15 1997/02/05 04:55:12 millert Exp $";
#endif
#endif /* not lint */
return;
}
if ((p->t_arg != NULL) && (*(p->t_arg) != '\0'))
- comret = command ("TYPE %s %s", p->t_mode, p->t_arg);
+ comret = command("TYPE %s %s", p->t_mode, p->t_arg);
else
comret = command("TYPE %s", p->t_mode);
if (comret == COMPLETE) {
printf("usage: %s [ on | off ]\n", argv[0]);
return -1;
}
- printf("%s %s.\n", mesg, onoff(*var));
+ if (mesg)
+ printf("%s %s.\n", mesg, onoff(*var));
return (*var);
}
jmp_buf abortprox;
void
-proxabort()
+proxabort(notused)
+ int notused;
{
alarmtimer(0);
char *argv[];
{
- code = togglevar(argc, argv, &passivemode, "Passive mode");
+ code = togglevar(argc, argv, &passivemode,
+ verbose ? "Passive mode" : NULL);
}
void
-/* $OpenBSD: complete.c,v 1.2 1997/02/03 01:05:35 millert Exp $ */
+/* $OpenBSD: complete.c,v 1.3 1997/02/05 04:55:14 millert Exp $ */
/* $NetBSD: complete.c,v 1.2 1997/02/01 10:44:57 lukem Exp $ */
/*-
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: complete.c,v 1.2 1997/02/03 01:05:35 millert Exp $";
+static char rcsid[] = "$OpenBSD: complete.c,v 1.3 1997/02/05 04:55:14 millert Exp $";
#endif /* not lint */
/*
int list;
StringList *words;
{
- char insertstr[MAXPATHLEN + 1];
+ char insertstr[MAXPATHLEN];
char *lastmatch;
int i, j, matchlen, wordlen;
int list;
{
StringList *words;
- char dir[MAXPATHLEN + 1];
+ char dir[MAXPATHLEN];
char *file;
DIR *dd;
struct dirent *dp;
int list;
{
static StringList *dirlist;
- static char lastdir[MAXPATHLEN + 1];
+ static char lastdir[MAXPATHLEN];
static int ftpdslashbug;
StringList *words;
- char dir[MAXPATHLEN + 1];
+ char dir[MAXPATHLEN];
char *file, *cp;
int i, offset;
unsigned char rv;
/* $NetBSD: extern.h,v 1.11 1997/02/01 10:44:58 lukem Exp $ */
-/* $OpenBSD: extern.h,v 1.7 1997/02/03 01:05:37 millert Exp $ */
+/* $OpenBSD: extern.h,v 1.8 1997/02/05 04:55:15 millert Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
struct fd_set;
void abort_remote __P((FILE *));
-void abortpt __P(());
-void abortrecv __P(());
-void abortsend __P(());
-void aborthttp __P(());
+void abortpt __P((int));
+void abortrecv __P((int));
+void abortsend __P((int));
+void aborthttp __P((int));
void account __P((int, char **));
void alarmtimer __P((int));
int another __P((int *, char ***, const char *));
void cd __P((int, char **));
void cdup __P((int, char **));
void changetype __P((int, int));
-void cmdabort __P(());
+void cmdabort __P((int));
void cmdscanner __P((int));
int command __P(());
#ifndef SMALLFTP
char *hookup __P((const char *, int));
void idle __P((int, char **));
int initconn __P((void));
-void intr __P(());
+void intr __P((void));
void list_vertical __P((StringList *));
void lcd __P((int, char **));
int login __P((const char *));
-void lostpeer __P(());
+void lostpeer __P((void));
void lpwd __P((int, char **));
void ls __P((int, char **));
void mabort __P((int));
char *onoff __P((int));
void newer __P((int, char **));
void progressmeter __P((int));
-char *prompt __P(());
-void proxabort __P(());
+char *prompt __P((void));
+void proxabort __P((int));
void proxtrans __P((const char *, const char *, const char *));
-void psabort __P(());
+void psabort __P((int));
void psummary __P((int));
void pswitch __P((int));
void ptransfer __P((int));
void status __P((int, char **));
void syst __P((int, char **));
int togglevar __P((int, char **, int *, const char *));
-void usage __P(());
+void usage __P((void));
void user __P((int, char **));
-/* $OpenBSD: fetch.c,v 1.2 1997/02/03 01:05:37 millert Exp $ */
+/* $OpenBSD: fetch.c,v 1.3 1997/02/05 04:55:16 millert Exp $ */
/* $NetBSD: fetch.c,v 1.2 1997/02/01 10:45:00 lukem Exp $ */
/*-
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: fetch.c,v 1.2 1997/02/03 01:05:37 millert Exp $";
+static char rcsid[] = "$OpenBSD: fetch.c,v 1.3 1997/02/05 04:55:16 millert Exp $";
#endif /* not lint */
/*
#include <err.h>
#include <netdb.h>
#include <fcntl.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* Abort a http retrieval
*/
void
-aborthttp()
+aborthttp(notused)
+ int notused;
{
alarmtimer(0);
disconnect(0, NULL);
return (argpos + 1);
}
- (void)signal(SIGINT, intr);
- (void)signal(SIGPIPE, lostpeer);
+ (void)signal(SIGINT, (sig_t)intr);
+ (void)signal(SIGPIPE, (sig_t)lostpeer);
/*
* Loop through as long as there's files to fetch.
-/* $OpenBSD: ftp.c,v 1.11 1997/02/03 01:05:40 millert Exp $ */
+/* $OpenBSD: ftp.c,v 1.12 1997/02/05 04:55:18 millert Exp $ */
/* $NetBSD: ftp.c,v 1.22 1997/02/01 10:45:03 lukem Exp $ */
/*
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
-static char rcsid[] = "$OpenBSD: ftp.c,v 1.11 1997/02/03 01:05:40 millert Exp $";
+static char rcsid[] = "$OpenBSD: ftp.c,v 1.12 1997/02/05 04:55:18 millert Exp $";
#endif
#endif /* not lint */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <utime.h>
#include <varargs.h>
#include "ftp_var.h"
int s, len, tos;
static char hostnamebuf[MAXHOSTNAMELEN];
- memset((char *)&hisctladdr, 0, sizeof(hisctladdr));
+ memset((void *)&hisctladdr, 0, sizeof(hisctladdr));
if (inet_aton(host, &hisctladdr.sin_addr) != 0) {
hisctladdr.sin_family = AF_INET;
(void)strncpy(hostnamebuf, host, sizeof(hostnamebuf) - 1);
{
char tmp[80];
char *user, *pass, *acct;
- char anonpass[MAXLOGNAME + MAXHOSTNAMELEN + 2]; /* "user@hostname\0" */
- char hostname[MAXHOSTNAMELEN + 1];
+ char anonpass[MAXLOGNAME + 1 + MAXHOSTNAMELEN]; /* "user@hostname" */
+ char hostname[MAXHOSTNAMELEN];
int n, aflag = 0;
user = pass = acct = NULL;
}
void
-cmdabort()
+cmdabort(notused)
+ int notused;
{
alarmtimer(0);
jmp_buf sendabort;
void
-abortsend()
+abortsend(notused)
+ int notused;
{
alarmtimer(0);
jmp_buf recvabort;
void
-abortrecv()
+abortrecv(notused)
+ int notused;
{
alarmtimer(0);
off_t hashbytes;
struct stat st;
time_t mtime;
- struct timeval tval[2];
hashbytes = mark;
direction = "received";
if (preserve && (closefunc == fclose)) {
mtime = remotemodtime(remote, 0);
if (mtime != -1) {
- (void)gettimeofday(&tval[0],
- (struct timezone *)0);
- tval[1].tv_sec = mtime;
- tval[1].tv_usec = 0;
- if (utimes(local, tval) == -1) {
+ struct utimbuf ut;
+
+ ut.actime = time(NULL);
+ ut.modtime = mtime;
+ if (utime(local, &ut) == -1)
printf("Can't change modification time on %s to %s",
local, asctime(localtime(&mtime)));
- }
}
}
}
}
void
-psabort()
+psabort(notused)
+ int notused;
{
alarmtimer(0);
}
void
-abortpt()
+abortpt(notused)
+ int notused;
{
alarmtimer(0);
-/* $OpenBSD: main.c,v 1.19 1997/02/03 01:22:08 millert Exp $ */
+/* $OpenBSD: main.c,v 1.20 1997/02/05 04:55:19 millert Exp $ */
/* $NetBSD: main.c,v 1.17 1997/02/01 10:45:07 lukem Exp $ */
/*
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.19 1997/02/03 01:22:08 millert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.20 1997/02/05 04:55:19 millert Exp $";
#endif
#endif /* not lint */
if (setjmp(toplevel))
exit(0);
- (void)signal(SIGINT, intr);
- (void)signal(SIGPIPE, lostpeer);
+ (void)signal(SIGINT, (sig_t)intr);
+ (void)signal(SIGPIPE, (sig_t)lostpeer);
xargv[0] = __progname;
xargv[1] = argv[0];
xargv[2] = argv[1];
}
top = setjmp(toplevel) == 0;
if (top) {
- (void)signal(SIGINT, intr);
- (void)signal(SIGPIPE, lostpeer);
+ (void)signal(SIGINT, (sig_t)intr);
+ (void)signal(SIGPIPE, (sig_t)lostpeer);
}
for (;;) {
cmdscanner(top);
if (c->c_handler != help)
break;
}
- (void)signal(SIGINT, intr);
- (void)signal(SIGPIPE, lostpeer);
+ (void)signal(SIGINT, (sig_t)intr);
+ (void)signal(SIGPIPE, (sig_t)lostpeer);
}
struct cmd *
-/* $OpenBSD: util.c,v 1.2 1997/02/03 01:05:46 millert Exp $ */
+/* $OpenBSD: util.c,v 1.3 1997/02/05 04:55:21 millert Exp $ */
/* $NetBSD: util.c,v 1.4 1997/02/01 11:26:34 lukem Exp $ */
/*
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.2 1997/02/03 01:05:46 millert Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.3 1997/02/05 04:55:21 millert Exp $";
#endif /* not lint */
/*
#include <ctype.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <glob.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
return (cp);
}
if (ftemp == NULL) {
- (void)snprintf(temp, sizeof(temp), "%s%s", _PATH_TMP, TMPFILE)
+ int len;
+
+ if ((cp = getenv("TMPDIR")) == NULL)
+ cp = _PATH_TMP;
+ len = strlen(cp);
+ if (len + sizeof(TMPFILE) + (cp[len-1] != '/') > sizeof(temp)) {
+ warnx("unable to create temporary file: %s",
+ strerror(ENAMETOOLONG));
+ return (NULL);
+ }
+
+ (void)strcpy(temp, cp);
+ if (temp[len-1] != '/')
+ temp[len++] = '/';
+ (void)strcpy(&temp[len], TMPFILE);
;
- fd = mkstemp(temp);
- if (fd < 0) {
+ if ((fd = mkstemp(temp)) < 0) {
warn("unable to create temporary file %s", temp);
return (NULL);
}