Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157556553
D57073.id178145.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D57073.id178145.diff
View Options
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -76,7 +76,7 @@
static char *margv[MAX_MARGV];
int verbose;
-static char *port = NULL;
+static char *port;
static void get(int, char **);
static void help(int, char **);
@@ -100,14 +100,14 @@
static void setpacketdrop(int, char **);
static void setwindowsize(int, char **);
-static void command(bool, EditLine *, History *, HistEvent *) __dead2;
+static void command(bool, EditLine *, History *, HistEvent *) __dead2;
static const char *command_prompt(void);
-static void urihandling(char *URI);
-static void getusage(char *);
-static void makeargv(char *argv0, char *line);
-static void putusage(char *);
-static void settftpmode(const char *);
+static void urihandling(char *URI);
+static void getusage(char *);
+static void makeargv(char *argv0, char *line);
+static void putusage(char *);
+static void settftpmode(const char *);
static char *tail(char *);
static const struct cmd *getcmd(const char *);
@@ -116,7 +116,7 @@
struct cmd {
const char *name;
- void (*handler)(int, char **);
+ void (*handler)(int, char **);
const char *help;
};
@@ -224,13 +224,13 @@
static void
urihandling(char *URI)
{
- char meth[] = "get";
- char *host = NULL;
- char *path = NULL;
- char *opts = NULL;
const char *tmode = "octet";
- char *s;
- int i;
+ char meth[] = "get";
+ char *host = NULL;
+ char *path = NULL;
+ char *opts = NULL;
+ char *s;
+ int i;
host = URI + 7;
@@ -271,8 +271,8 @@
setpeer0(char *host, const char *lport)
{
struct addrinfo hints, *res0, *res;
- int error;
const char *cause = "unknown";
+ int error;
if (connected) {
close(peer);
@@ -345,7 +345,7 @@
argc = margc;
argv = margv;
}
- if ((argc < 2) || (argc > 3)) {
+ if (argc < 2 || argc > 3) {
printf("usage: %s [host [port]]\n", argv[0]);
return;
}
@@ -392,21 +392,18 @@
static void
setbinary(int argc __unused, char *argv[] __unused)
{
-
settftpmode("octet");
}
static void
setascii(int argc __unused, char *argv[] __unused)
{
-
settftpmode("netascii");
}
static void
settftpmode(const char *newmode)
{
-
strlcpy(mode, newmode, sizeof(mode));
if (verbose)
printf("mode set to %s\n", mode);
@@ -421,9 +418,9 @@
{
static char *line;
static size_t sz;
- int fd, n;
- char *cp, *targ, *path;
struct stat sb;
+ char *cp, *targ, *path;
+ int fd, n;
if (argc < 2) {
printf("(file) ");
@@ -516,7 +513,6 @@
static void
putusage(char *s)
{
-
printf("usage: %s file [remotename]\n", s);
printf(" %s file host:remotename\n", s);
printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s);
@@ -530,8 +526,8 @@
{
static char *line;
static size_t sz;
- int fd, n;
char *cp, *src;
+ int fd, n;
if (argc < 2) {
printf("(files) ");
@@ -607,7 +603,6 @@
static void
getusage(char *s)
{
-
printf("usage: %s file [localname]\n", s);
printf(" %s [host:]file [localname]\n", s);
printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s);
@@ -670,7 +665,6 @@
static void
showstatus(int argc __unused, char *argv[] __unused)
{
-
printf("Remote host: %s\n",
connected ? hostname : "none specified yet");
printf("RFC2347 Options support: %s\n",
@@ -691,7 +685,6 @@
static void
intr(int dummy __unused)
{
-
signal(SIGALRM, SIG_IGN);
alarm(0);
longjmp(toplevel, -1);
@@ -716,7 +709,6 @@
static const char *
command_prompt(void)
{
-
return ("tftp> ");
}
@@ -834,7 +826,6 @@
static void
quit(int argc __unused, char *argv[] __unused)
{
-
exit(txrx_error);
}
@@ -872,7 +863,6 @@
static void
setverbose(int argc __unused, char *argv[] __unused)
{
-
verbose = !verbose;
printf("Verbose mode %s.\n", verbose ? "on" : "off");
}
@@ -880,7 +870,6 @@
static void
setoptions(int argc, char *argv[])
{
-
if (argc == 2) {
if (strcasecmp(argv[1], "enable") == 0 ||
strcasecmp(argv[1], "on") == 0) {
@@ -910,7 +899,6 @@
static void
setrollover(int argc, char *argv[])
{
-
if (argc == 2) {
if (strcasecmp(argv[1], "never") == 0 ||
strcasecmp(argv[1], "none") == 0) {
@@ -961,7 +949,6 @@
static void
setblocksize(int argc, char *argv[])
{
-
if (!options_rfc_enabled)
printf("RFC2347 style options are not enabled "
"(but proceeding anyway)\n");
@@ -997,7 +984,6 @@
static void
setblocksize2(int argc, char *argv[])
{
-
if (!options_rfc_enabled || !options_extra_enabled)
printf(
"RFC2347 style or non-RFC defined options are not enabled "
@@ -1053,7 +1039,6 @@
static void
setpacketdrop(int argc, char *argv[])
{
-
if (argc != 1)
packetdroppercentage = atoi(argv[1]);
@@ -1064,7 +1049,6 @@
static void
setwindowsize(int argc, char *argv[])
{
-
if (!options_rfc_enabled)
printf("RFC2347 style options are not enabled "
"(but proceeding anyway)\n");
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -63,13 +63,13 @@
int
xmitfile(int peer, char *port, int fd, char *name, char *mode)
{
+ char recvbuffer[MAXPKTSIZE];
+ struct sockaddr_storage serv; /* valid server port number */
+ struct tftp_stats tftp_stats;
struct tftphdr *rp;
struct servent *se;
int n, i, ret = 0;
uint16_t block, portn;
- struct sockaddr_storage serv; /* valid server port number */
- char recvbuffer[MAXPKTSIZE];
- struct tftp_stats tftp_stats;
stats_init(&tftp_stats);
@@ -167,11 +167,11 @@
int
recvfile(int peer, char *port, int fd, char *name, char *mode)
{
- struct tftphdr *rp;
- uint16_t block;
char recvbuffer[MAXPKTSIZE];
- int n, i, ret = 0;
struct tftp_stats tftp_stats;
+ struct tftphdr *rp;
+ int n, i, ret = 0;
+ uint16_t block;
stats_init(&tftp_stats);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 23, 7:18 PM (5 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33452466
Default Alt Text
D57073.id178145.diff (5 KB)
Attached To
Mode
D57073: tftp: Style cleanup
Attached
Detach File
Event Timeline
Log In to Comment