* Cast %q[ud] arguments to fix ILP32/LP64 off_t variation.

* Fix bug in 213 reply: correct ordering of format string args.
This commit is contained in:
ross 1999-05-24 21:57:19 +00:00
parent 7486995102
commit f0923ed12e
2 changed files with 33 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftpcmd.y,v 1.29 1999/05/24 21:18:03 ross Exp $ */
/* $NetBSD: ftpcmd.y,v 1.30 1999/05/24 21:57:19 ross Exp $ */
/*
* Copyright (c) 1985, 1988, 1993, 1994
@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: ftpcmd.y,v 1.29 1999/05/24 21:18:03 ross Exp $");
__RCSID("$NetBSD: ftpcmd.y,v 1.30 1999/05/24 21:57:19 ross Exp $");
#endif
#endif /* not lint */
@ -189,20 +189,20 @@ cmd
lreply(221, "");
lreply(0,
"Data traffic for this session was %qd byte%s in %qd file%s.",
total_data, PLURAL(total_data),
total_files, PLURAL(total_files));
(qdfmt_t)total_data, PLURAL(total_data),
(qdfmt_t)total_files, PLURAL(total_files));
lreply(0,
"Total traffic for this session was %qd byte%s in %qd transfer%s.",
total_bytes, PLURAL(total_bytes),
total_xfers, PLURAL(total_xfers));
(qdfmt_t)total_bytes, PLURAL(total_bytes),
(qdfmt_t)total_xfers, PLURAL(total_xfers));
syslog(LOG_INFO,
"Data traffic: %qd byte%s in %qd file%s",
(long long)total_data, PLURAL(total_data),
(long long)total_files, PLURAL(total_files));
(qdfmt_t)total_data, PLURAL(total_data),
(qdfmt_t)total_files, PLURAL(total_files));
syslog(LOG_INFO,
"Total traffic: %qd byte%s in %qd transfer%s",
(long long)total_bytes, PLURAL(total_bytes),
(long long)total_xfers, PLURAL(total_xfers));
(qdfmt_t)total_bytes, PLURAL(total_bytes),
(qdfmt_t)total_xfers, PLURAL(total_xfers));
}
reply(221,
"Thank you for using the FTP service on %s.",
@ -657,7 +657,8 @@ rcmd
{
fromname = NULL;
restart_point = $3; /* XXX $3 is only "int" */
reply(350, "Restarting at %qd. %s", restart_point,
reply(350, "Restarting at %qd. %s",
(qdfmt_t)restart_point,
"Send STORE or RETRIEVE to initiate transfer.");
}
| RNFR check_modify SP pathname CRLF
@ -1483,7 +1484,7 @@ sizecmd(filename)
if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
reply(550, "%s: not a plain file.", filename);
else
reply(213, "%qu", stbuf.st_size);
reply(213, "%qu", (qufmt_t)stbuf.st_size);
break; }
case TYPE_A: {
FILE *fin;
@ -1509,7 +1510,7 @@ sizecmd(filename)
}
(void) fclose(fin);
reply(213, "%qd", count);
reply(213, "%qd", (qdfmt_t)count);
break; }
default:
reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftpd.c,v 1.64 1999/05/19 21:44:29 thorpej Exp $ */
/* $NetBSD: ftpd.c,v 1.65 1999/05/24 21:57:19 ross Exp $ */
/*
* Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994
@ -80,7 +80,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: ftpd.c,v 1.64 1999/05/19 21:44:29 thorpej Exp $");
__RCSID("$NetBSD: ftpd.c,v 1.65 1999/05/24 21:57:19 ross Exp $");
#endif
#endif /* not lint */
@ -1063,7 +1063,7 @@ dataconn(name, size, mode)
byte_count = 0;
if (size != (off_t) -1)
(void)snprintf(sizebuf, sizeof(sizebuf), " (%qd byte%s)",
(long long)size, PLURAL(size));
(qdfmt_t)size, PLURAL(size));
else
sizebuf[0] = '\0';
if (pdata >= 0) {
@ -1463,24 +1463,27 @@ printaddr:
if (logged_in) {
lreply(0, "Data sent: %qd byte%s in %qd file%s",
total_data_out, PLURAL(total_data_out),
total_files_out, PLURAL(total_files_out));
(qdfmt_t)total_data_out, PLURAL(total_data_out),
(qdfmt_t)total_files_out, PLURAL(total_files_out));
lreply(0, "Data received: %qd byte%s in %qd file%s",
total_data_in, PLURAL(total_data_in),
total_files_in, PLURAL(total_files_in));
(qdfmt_t)total_data_in, PLURAL(total_data_in),
(qdfmt_t)total_files_in, PLURAL(total_files_in));
lreply(0, "Total data: %qd byte%s in %qd file%s",
total_data, PLURAL(total_data),
total_files, PLURAL(total_files));
(qdfmt_t)total_data, PLURAL(total_data),
(qdfmt_t)total_files, PLURAL(total_files));
}
otbi = total_bytes_in;
otbo = total_bytes_out;
otb = total_bytes;
lreply(0, "Traffic sent: %qd byte%s in %qd transfer%s",
otbo, PLURAL(otbo), total_xfers_out, PLURAL(total_xfers_out));
(qdfmt_t)otbo, PLURAL(otbo),
(qdfmt_t)total_xfers_out, PLURAL(total_xfers_out));
lreply(0, "Traffic received: %qd byte%s in %qd transfer%s",
otbi, PLURAL(otbi), total_xfers_in, PLURAL(total_xfers_in));
(qdfmt_t)otbi, PLURAL(otbi),
(qdfmt_t)total_xfers_in, PLURAL(total_xfers_in));
lreply(0, "Total traffic: %qd byte%s in %qd transfer%s",
otb, PLURAL(otb), total_xfers, PLURAL(total_xfers));
(qdfmt_t)otb, PLURAL(otb),
(qdfmt_t)total_xfers, PLURAL(total_xfers));
if (logged_in) {
struct ftpconv *cp;
@ -1780,10 +1783,11 @@ myoob(signo)
if (strcasecmp(cp, "STAT\r\n") == 0) {
if (file_size != (off_t) -1)
reply(213, "Status: %qd of %qd byte%s transferred",
byte_count, PLURAL(byte_count), file_size);
(qdfmt_t)byte_count, (qdfmt_t)file_size,
PLURAL(byte_count));
else
reply(213, "Status: %qd byte%s transferred",
byte_count, PLURAL(byte_count));
(qdfmt_t)byte_count, PLURAL(byte_count));
}
}
@ -2093,7 +2097,7 @@ logcmd(command, bytes, file1, file2, elapsed, error)
if (bytes != (off_t)-1) {
len += snprintf(buf + len, sizeof(buf) - len,
" = %qd byte%s", (long long) bytes, PLURAL(bytes));
" = %qd byte%s", (qdfmt_t) bytes, PLURAL(bytes));
} else if (file2 != NULL) {
if ((p = realpath(file2, realfile)) == NULL) {
#if 0 /* XXX: too noisy */