summaryrefslogtreecommitdiffstats
path: root/usr.bin/tftp/main.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2001-10-19 12:27:26 +0000
committerbde <bde@FreeBSD.org>2001-10-19 12:27:26 +0000
commitcd74f3103976553b9405a4c458b37575b4b220bb (patch)
treed2e5d3f70e94cbf65e0e26227ee16633da93cc1a /usr.bin/tftp/main.c
parentd30f6fbf2275f529948d4293bbc307a45a32e156 (diff)
downloadFreeBSD-src-cd74f3103976553b9405a4c458b37575b4b220bb.zip
FreeBSD-src-cd74f3103976553b9405a4c458b37575b4b220bb.tar.gz
Fixed most style bugs in previous commit.
Diffstat (limited to 'usr.bin/tftp/main.c')
-rw-r--r--usr.bin/tftp/main.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 4d7f5f2..eacb88a 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -62,6 +62,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
+#include <histedit.h>
#include <netdb.h>
#include <setjmp.h>
#include <signal.h>
@@ -70,14 +71,11 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
-#include <histedit.h>
-
#include "extern.h"
+#define MAXLINE 200
#define TIMEOUT 5 /* secs between rexmt's */
-#define MAXLINE 200
-
struct sockaddr_in peeraddr;
int f;
short port;
@@ -107,6 +105,7 @@ void setverbose __P((int, char **));
void status __P((int, char **));
static void command __P((void)) __dead2;
+static const char *command_prompt __P((void));
static void getusage __P((char *));
static void makeargv __P((void));
@@ -593,7 +592,9 @@ tail(filename)
}
static const char *
-command_prompt() {
+command_prompt()
+{
+
return ("tftp> ");
}
@@ -603,17 +604,15 @@ command_prompt() {
static void
command()
{
+ HistEvent he;
register struct cmd *c;
+ static EditLine *el;
+ static History *hist;
+ const char *bp;
char *cp;
- static EditLine *el = NULL;
- static History *hist = NULL;
- HistEvent he;
- const char * bp;
- int len, num;
- int verbose;
+ int len, num, verbose;
verbose = isatty(0);
-
if (verbose) {
el = el_init("tftp", stdin, stdout, stderr);
hist = history_init();
@@ -624,12 +623,10 @@ command()
el_set(el, EL_SIGNAL, 1);
el_source(el, NULL);
}
-
for (;;) {
if (verbose) {
if ((bp = el_gets(el, &num)) == NULL || num == 0)
exit(0);
-
len = (num > MAXLINE) ? MAXLINE : num;
memcpy(line, bp, len);
line[len] = '\0';
OpenPOWER on IntegriCloud