Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ftpd * Cast %q[ud] arguments to fix ILP32/LP64 off_t...



details:   https://anonhg.NetBSD.org/src/rev/f135f31c2823
branches:  trunk
changeset: 473205:f135f31c2823
user:      ross <ross%NetBSD.org@localhost>
date:      Mon May 24 21:57:19 1999 +0000

description:
* Cast %q[ud] arguments to fix ILP32/LP64 off_t variation.
* Fix bug in 213 reply: correct ordering of format string args.

diffstat:

 libexec/ftpd/ftpcmd.y |  27 ++++++++++++++-------------
 libexec/ftpd/ftpd.c   |  34 +++++++++++++++++++---------------
 2 files changed, 33 insertions(+), 28 deletions(-)

diffs (162 lines):

diff -r 686fb5458b8f -r f135f31c2823 libexec/ftpd/ftpcmd.y
--- a/libexec/ftpd/ftpcmd.y     Mon May 24 21:54:42 1999 +0000
+++ b/libexec/ftpd/ftpcmd.y     Mon May 24 21:57:19 1999 +0000
@@ -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 @@
                                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 @@
                {
                        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 @@
                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 @@
                }
                (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]);
diff -r 686fb5458b8f -r f135f31c2823 libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c       Mon May 24 21:54:42 1999 +0000
+++ b/libexec/ftpd/ftpd.c       Mon May 24 21:57:19 1999 +0000
@@ -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 @@
 #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 @@
        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 @@
 
        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 @@
        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 @@
 
        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 */



Home | Main Index | Thread Index | Old Index