diff options
| author | lukem <lukem@NetBSD.org> | 2000-11-15 02:32:30 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2000-11-15 02:32:30 +0000 |
| commit | f62aa6c8acfc1fa527a4e331c2bc885530f006eb (patch) | |
| tree | a402f0301cb254a4157881d80bdd2e8dc8cfd1a0 /libexec/ftpd/cmds.c | |
| parent | 038ca0a1464a7d5fcf493ac2ba844124839a030d (diff) | |
changes to improve portability:
* replace union sockunion {} with struct sockinet {}, and modify the code
accordingly. this is possibly more portable, as it doesn't rely upon
the structure alignment within the union for our own stuff. uses local
su_len unless HAVE_SOCKADDR_SA_LEN is defined (set ifdef BSD4_4)
(XXX: haven't tested the ipv6 stuff)
* always use getaddrinfo() and getnameinfo() instead of maintaining two code
paths. (lukemftpd will provide replacements for these on older systems)
* use lockf() instead of open(.., O_EXLOCK) to lock the pid file
* minor KNF
* clean up long long support: create helper #defines and use as appropriate:
#define NO_LONG_LONG ! NO_LONG_LONG
------- ------------ --------------
LLF "%ld" "%lld"
LLFP(x) "%" x "ld" "%" x "lld"
LLT long long long
ULLF "%lu" "%llu"
ULLFP(x) "%" x "lu" "%" x "llu"
ULLT unsigned long unsigned long long
STRTOLL(x,y,z) strtol(x,y,z) strtoll(x,y,z)
Diffstat (limited to 'libexec/ftpd/cmds.c')
| -rw-r--r-- | libexec/ftpd/cmds.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libexec/ftpd/cmds.c b/libexec/ftpd/cmds.c index e2430d1f98b..600b0a4e8c8 100644 --- a/libexec/ftpd/cmds.c +++ b/libexec/ftpd/cmds.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.6 2000/07/10 22:41:17 lukem Exp $ */ +/* $NetBSD: cmds.c,v 1.7 2000/11/15 02:32:30 lukem Exp $ */ /* * Copyright (c) 1999-2000 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: cmds.c,v 1.6 2000/07/10 22:41:17 lukem Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.7 2000/11/15 02:32:30 lukem Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -451,7 +451,7 @@ sizecmd(const char *filename) if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) reply(550, "%s: not a plain file.", filename); else - reply(213, "%qu", (qufmt_t)stbuf.st_size); + reply(213, ULLF, (ULLT)stbuf.st_size); break; } case TYPE_A: { FILE *fin; @@ -477,7 +477,7 @@ sizecmd(const char *filename) } (void) fclose(fin); - reply(213, "%qd", (qdfmt_t)count); + reply(213, LLF, (LLT)count); break; } default: reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]); @@ -705,7 +705,7 @@ fact_size(const char *fact, FILE *fd, factelem *fe) { if (S_ISREG(fe->stat->st_mode)) - cprintf(fd, "%s=%lld;", fact, (long long)fe->stat->st_size); + cprintf(fd, "%s=" LLF ";", fact, (LLT)fe->stat->st_size); } static void |
