add --logfile option, use htons() on port number

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18115 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-09-19 10:20:50 +00:00
parent 99a2e32cad
commit c1e7cda8e8

View File

@@ -818,14 +818,17 @@ handleServer(void *ptr)
static char *port_str;
static int version_flag;
static int help_flag;
static char *logfile_str;
static int port = 4711;
struct getargs args[] = {
{ "spn", 0, arg_string, &targetname, "This host's SPN",
"number-of-service" },
"service/host@REALM" },
{ "port", 'p', arg_string, &port_str, "Use this port",
"number-of-service" },
{ "logfile", 0, arg_string, &logfile_str, "logfile",
"number-of-service" },
{ "version", 0, arg_flag, &version_flag, "Print version",
NULL },
{ "help", 0, arg_flag, &help_flag, NULL,
@@ -873,11 +876,17 @@ main(int argc, char **argv)
krb5_init_context(&context);
logfile = fopen("/dev/tty", "w");
if (logfile == NULL)
err(1, "error opening /dev/tty");
{
const char *lf = logfile_str;
if (lf == NULL)
lf = "/dev/tty";
mini_inetd(port);
logfile = fopen(lf, "w");
if (logfile == NULL)
err(1, "error opening %s", lf);
}
mini_inetd(htons(port));
fprintf(logfile, "connected\n");
{