Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ftp - rename NO_QUAD to NO_LONG_LONG, QUAD* -> LL* a...
details: https://anonhg.NetBSD.org/src/rev/7ce94ab3ed3c
branches: trunk
changeset: 495618:7ce94ab3ed3c
user: lukem <lukem%NetBSD.org@localhost>
date: Tue Aug 01 22:47:25 2000 +0000
description:
- rename NO_QUAD to NO_LONG_LONG, QUAD* -> LL* and add ULL* (unsigned)
equivalents. name change suggested by Klaus Klein <kjk%netbsd.org@localhost>
- change defined(BSD4_4) || HAVE_SIN_LEN tests into HAVE_SOCKADDR_SA_LEN,
and set the latter if BSD4_4 exists
diffstat:
usr.bin/ftp/cmds.c | 10 +++++-----
usr.bin/ftp/fetch.c | 32 ++++++++++++++++----------------
usr.bin/ftp/ftp.c | 18 +++++++++---------
usr.bin/ftp/ftp_var.h | 25 +++++++++++++++++--------
usr.bin/ftp/util.c | 20 ++++++++++----------
usr.bin/ftp/version.h | 4 ++--
6 files changed, 59 insertions(+), 50 deletions(-)
diffs (truncated from 316 to 300 lines):
diff -r 9933efa380d5 -r 7ce94ab3ed3c usr.bin/ftp/cmds.c
--- a/usr.bin/ftp/cmds.c Tue Aug 01 22:45:05 2000 +0000
+++ b/usr.bin/ftp/cmds.c Tue Aug 01 22:47:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmds.c,v 1.89 2000/07/30 04:42:37 lukem Exp $ */
+/* $NetBSD: cmds.c,v 1.90 2000/08/01 22:47:25 lukem Exp $ */
/*-
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: cmds.c,v 1.89 2000/07/30 04:42:37 lukem Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.90 2000/08/01 22:47:25 lukem Exp $");
#endif
#endif /* not lint */
@@ -2313,8 +2313,8 @@
fputs("No restart point defined.\n", ttyout);
else
fprintf(ttyout,
- "Restarting at " QUADF " for next get, put or append\n",
- (QUADT)restart_point);
+ "Restarting at " LLF " for next get, put or append\n",
+ (LLT)restart_point);
}
/*
@@ -2416,7 +2416,7 @@
size = remotesize(argv[1], 1);
if (size != -1)
fprintf(ttyout,
- "%s\t" QUADF "\n", argv[1], (QUADT)size);
+ "%s\t" LLF "\n", argv[1], (LLT)size);
code = (size > 0);
}
diff -r 9933efa380d5 -r 7ce94ab3ed3c usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c Tue Aug 01 22:45:05 2000 +0000
+++ b/usr.bin/ftp/fetch.c Tue Aug 01 22:47:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.120 2000/07/30 06:10:43 lukem Exp $ */
+/* $NetBSD: fetch.c,v 1.121 2000/08/01 22:47:27 lukem Exp $ */
/*-
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.120 2000/07/30 06:10:43 lukem Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.121 2000/08/01 22:47:27 lukem Exp $");
#endif /* not lint */
/*
@@ -557,8 +557,8 @@
if (verbose) {
fprintf(ttyout, "Copying %s", decodedpath);
if (restart_point)
- fprintf(ttyout, " (restarting at " QUADF ")",
- (QUADT)restart_point);
+ fprintf(ttyout, " (restarting at " LLF ")",
+ (LLT)restart_point);
fputs("\n", ttyout);
}
} else { /* ftp:// or http:// URLs */
@@ -742,10 +742,10 @@
fprintf(fin, "Connection: close\r\n");
if (restart_point) {
fputs(leading, ttyout);
- fprintf(fin, "Range: bytes=" QUADF "-\r\n",
- (QUADT)restart_point);
- fprintf(ttyout, "restarting at " QUADF,
- (QUADT)restart_point);
+ fprintf(fin, "Range: bytes=" LLF "-\r\n",
+ (LLT)restart_point);
+ fprintf(ttyout, "restarting at " LLF,
+ (LLT)restart_point);
leading = ", ";
hasleading++;
}
@@ -828,8 +828,8 @@
goto improper;
if (debug)
fprintf(ttyout,
- "parsed len as: " QUADF "\n",
- (QUADT)filesize);
+ "parsed len as: " LLF "\n",
+ (LLT)filesize);
#define CONTENTRANGE "Content-Range: bytes "
} else if (strncasecmp(cp, CONTENTRANGE,
@@ -851,10 +851,10 @@
if (debug)
fprintf(ttyout,
"parsed range as: "
- QUADF "-" QUADF "/" QUADF "\n",
- (QUADT)rangestart,
- (QUADT)rangeend,
- (QUADT)entitylen);
+ LLF "-" LLF "/" LLF "\n",
+ (LLT)rangestart,
+ (LLT)rangeend,
+ (LLT)entitylen);
if (! restart_point) {
warnx(
"Received unexpected Content-Range header");
@@ -1110,8 +1110,8 @@
goto cleanup_fetch_url;
}
if (debug)
- fprintf(ttyout, "got chunksize of " QUADF "\n",
- (QUADT)chunksize);
+ fprintf(ttyout, "got chunksize of " LLF "\n",
+ (LLT)chunksize);
if (chunksize == 0)
break;
}
diff -r 9933efa380d5 -r 7ce94ab3ed3c usr.bin/ftp/ftp.c
--- a/usr.bin/ftp/ftp.c Tue Aug 01 22:45:05 2000 +0000
+++ b/usr.bin/ftp/ftp.c Tue Aug 01 22:47:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftp.c,v 1.106 2000/07/31 00:56:07 lukem Exp $ */
+/* $NetBSD: ftp.c,v 1.107 2000/08/01 22:47:28 lukem Exp $ */
/*-
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
-__RCSID("$NetBSD: ftp.c,v 1.106 2000/07/31 00:56:07 lukem Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.107 2000/08/01 22:47:28 lukem Exp $");
#endif
#endif /* not lint */
@@ -151,12 +151,12 @@
struct sockaddr_in6 su_sin6;
#endif
} si_su;
-#if !defined(BSD4_4) && !HAVE_SIN_LEN
+#if !HAVE_SOCKADDR_SA_LEN
int si_len;
#endif
};
-#if !defined(BSD4_4) && !HAVE_SIN_LEN
+#if !HAVE_SOCKADDR_SA_LEN
# define su_len si_len
#else
# define su_len si_su.su_sin.sin_len
@@ -729,7 +729,7 @@
warn("local: %s", local);
goto cleanupsend;
}
- if (command("REST " QUADF, (QUADT)restart_point) != CONTINUE)
+ if (command("REST " LLF, (LLT)restart_point) != CONTINUE)
goto cleanupsend;
lmode = "r+w";
}
@@ -1033,7 +1033,7 @@
if (sigsetjmp(xferabort, 1))
goto abort;
if (is_retr && restart_point &&
- command("REST " QUADF, (QUADT) restart_point) != CONTINUE)
+ command("REST " LLF, (LLT) restart_point) != CONTINUE)
goto cleanuprecv;
if (! EMPTYSTRING(remote)) {
if (command("%s %s", cmd, remote) != PRELIM)
@@ -1885,7 +1885,7 @@
goto abort;
oldintr = xsignal(SIGINT, abortpt);
if ((restart_point &&
- (command("REST " QUADF, (QUADT) restart_point) != CONTINUE))
+ (command("REST " LLF, (LLT) restart_point) != CONTINUE))
|| (command("%s %s", cmd, remote) != PRELIM)) {
(void)xsignal(SIGINT, oldintr);
pswitch(1);
@@ -1895,7 +1895,7 @@
pswitch(1);
secndflag++;
if ((restart_point &&
- (command("REST " QUADF, (QUADT) restart_point) != CONTINUE))
+ (command("REST " LLF, (LLT) restart_point) != CONTINUE))
|| (command("%s %s", cmd2, local) != PRELIM))
goto abort;
ptflag++;
@@ -2120,7 +2120,7 @@
sin.sin_port = sin6->sin6_port;
ai->ai_family = AF_INET;
-#if defined(BSD4_4) || HAVE_SIN_LEN
+#if HAVE_SOCKADDR_SA_LEN
sin.sin_len = len;
#endif
memcpy(ai->ai_addr, &sin, len);
diff -r 9933efa380d5 -r 7ce94ab3ed3c usr.bin/ftp/ftp_var.h
--- a/usr.bin/ftp/ftp_var.h Tue Aug 01 22:45:05 2000 +0000
+++ b/usr.bin/ftp/ftp_var.h Tue Aug 01 22:47:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftp_var.h,v 1.57 2000/07/30 04:42:38 lukem Exp $ */
+/* $NetBSD: ftp_var.h,v 1.58 2000/08/01 22:47:28 lukem Exp $ */
/*-
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
@@ -338,15 +338,24 @@
#define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0'))
#define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
+#ifdef BSD4_4
+# define HAVE_SOCKADDR_SA_LEN 1
+#endif
-#ifdef NO_QUAD
-# define QUADF "%ld"
-# define QUADFP(x) "%" x "ld"
-# define QUADT long
+#ifdef NO_LONG_LONG
+# define LLF "%ld"
+# define LLFP(x) "%" x "ld"
+# define LLT long
+# define ULLF "%lu"
+# define ULLFP(x) "%" x "lu"
+# define ULLT unsigned long
# define STRTOLL(x,y,z) strtol(x,y,z)
#else
-# define QUADF "%lld"
-# define QUADFP(x) "%" x "lld"
-# define QUADT long long
+# define LLF "%lld"
+# define LLFP(x) "%" x "lld"
+# define LLT long long
+# define ULLF "%llu"
+# define ULLFP(x) "%" x "llu"
+# define ULLT unsigned long long
# define STRTOLL(x,y,z) strtoll(x,y,z)
#endif
diff -r 9933efa380d5 -r 7ce94ab3ed3c usr.bin/ftp/util.c
--- a/usr.bin/ftp/util.c Tue Aug 01 22:45:05 2000 +0000
+++ b/usr.bin/ftp/util.c Tue Aug 01 22:47:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.98 2000/07/30 04:42:38 lukem Exp $ */
+/* $NetBSD: util.c,v 1.99 2000/08/01 22:47:29 lukem Exp $ */
/*-
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: util.c,v 1.98 2000/07/30 04:42:38 lukem Exp $");
+__RCSID("$NetBSD: util.c,v 1.99 2000/08/01 22:47:29 lukem Exp $");
#endif /* not lint */
/*
@@ -934,8 +934,8 @@
abbrevsize = cursize;
for (i = 0; abbrevsize >= 100000 && i < sizeof(prefixes); i++)
abbrevsize >>= 10;
- len += snprintf(buf + len, BUFLEFT, " " QUADFP("5") " %c%c ",
- (QUADT)abbrevsize,
+ len += snprintf(buf + len, BUFLEFT, " " LLFP("5") " %c%c ",
+ (LLT)abbrevsize,
prefixes[i],
i == 0 ? ' ' : 'B');
@@ -951,8 +951,8 @@
for (i = 1; bytespersec >= 1024000 && i < sizeof(prefixes); i++)
bytespersec >>= 10;
len += snprintf(buf + len, BUFLEFT,
- " " QUADFP("3") ".%02d %cB/s ",
- (QUADT)(bytespersec / 1024),
+ " " LLFP("3") ".%02d %cB/s ",
+ (LLT)(bytespersec / 1024),
(int)((bytespersec % 1024) * 100 / 1024),
prefixes[i]);
@@ -1021,8 +1021,8 @@
bytespersec /= elapsed;
}
len = 0;
- len += snprintf(buf + len, BUFLEFT, QUADF " byte%s %s in ",
- (QUADT)bytes, bytes == 1 ? "" : "s", direction);
+ len += snprintf(buf + len, BUFLEFT, LLF " byte%s %s in ",
+ (LLT)bytes, bytes == 1 ? "" : "s", direction);
remaining = (int)elapsed;
if (remaining > SECSPERDAY) {
int days;
@@ -1041,8 +1041,8 @@
for (i = 1; bytespersec >= 1024000 && i < sizeof(prefixes); i++)
bytespersec >>= 10;
- len += snprintf(buf + len, BUFLEFT, "(" QUADF ".%02d %cB/s)",
- (QUADT)(bytespersec / 1024),
+ len += snprintf(buf + len, BUFLEFT, "(" LLF ".%02d %cB/s)",
+ (LLT)(bytespersec / 1024),
(int)((bytespersec % 1024) * 100 / 1024),
prefixes[i]);
Home |
Main Index |
Thread Index |
Old Index