const char *serverlogfile = DEFAULT_LOGFILE;
-bool verbose = FALSE;
-bool use_ipv6 = FALSE;
-unsigned short port = DEFAULT_PORT;
-unsigned short connectport = 0; /* if non-zero, we activate this mode */
+static bool verbose = FALSE;
+static bool use_ipv6 = FALSE;
+static unsigned short port = DEFAULT_PORT;
+static unsigned short connectport = 0; /* if non-zero, we activate this mode */
enum sockmode {
PASSIVE_LISTEN, /* as a server waiting for connections */
#define REQBUFSIZ 150000
#define REQBUFSIZ_TXT "149999"
-long prevtestno=-1; /* previous test number we served */
-long prevpartno=-1; /* previous part number we served */
-bool prevbounce=FALSE; /* instructs the server to increase the part number for
- a test in case the identical testno+partno request
- shows up again */
+static long prevtestno=-1; /* previous test number we served */
+static long prevpartno=-1; /* previous part number we served */
+static bool prevbounce=FALSE; /* instructs the server to increase the part
+ number for a test in case the identical
+ testno+partno request shows up again */
#define RCMD_NORMALREQ 0 /* default request, use the tests file normally */
#define RCMD_IDLE 1 /* told to sit idle */
return 0;
}
-bool use_ipv6=FALSE;
+static bool use_ipv6=FALSE;
int main(int argc, char *argv[])
{
#define PKTSIZE SEGSIZE+4
-struct formats;
+struct formats {
+ const char *f_mode;
+ int f_convert;
+};
+static struct formats formata[] = {
+ { "netascii", 1 },
+ { "octet", 0 },
+ { NULL, 0 }
+};
+
static int tftp(struct testcase *test, struct tftphdr *tp, ssize_t size);
static void nak(int error);
static void sendtftp(struct testcase *test, struct formats *pf);
struct bf {
int counter; /* size of data in buffer, or flag */
char buf[PKTSIZE]; /* room for data packet */
-} bfs[2];
+};
+static struct bf bfs[2];
/* Values for bf.counter */
#define BF_ALLOC -3 /* alloc'd but not yet filled */
static int nextone; /* index of next buffer to use */
static int current; /* index of buffer in use */
- /* control flags for crlf conversions */
-int newline = 0; /* fillbuf: in middle of newline expansion */
-int prevchar = -1; /* putbuf: previous char (cr check) */
+ /* control flags for crlf conversions */
+static int newline = 0; /* fillbuf: in middle of newline expansion */
+static int prevchar = -1; /* putbuf: previous char (cr check) */
static void read_ahead(struct testcase *test,
int convert /* if true, convert to ascii */);
#define REQUEST_DUMP "log/server.input"
-char use_ipv6=FALSE;
+static char use_ipv6=FALSE;
int main(int argc, char **argv)
{
return result;
}
-struct formats {
- const char *f_mode;
- int f_convert;
-} formats[] = {
- { "netascii", 1 },
- { "octet", 0 },
- { NULL, 0 }
-};
-
/*
* Handle initial connection protocol.
*/
fprintf(server, "mode: %s\n", mode);
fclose(server);
- for (pf = formats; pf->f_mode; pf++)
+ for (pf = formata; pf->f_mode; pf++)
if (strcmp(pf->f_mode, mode) == 0)
break;
if (!pf->f_mode) {
return 0;
}
-int timeout;
+static int timeout;
#ifdef HAVE_SIGSETJMP
-sigjmp_buf timeoutbuf;
+static sigjmp_buf timeoutbuf;
#endif
static void timer(int signum)
struct errmsg {
int e_code;
const char *e_msg;
-} errmsgs[] = {
+};
+static struct errmsg errmsgs[] = {
{ EUNDEF, "Undefined error code" },
{ ENOTFOUND, "File not found" },
{ EACCESS, "Access violation" },