From: sgunderson@bigfoot.com <> Date: Wed, 31 Jan 2007 17:22:07 +0000 (+0100) Subject: Make the port configurable. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b71aff9637ef59f1130a4ee51669175d764948fc;p=jam Make the port configurable. --- diff --git a/jam.c b/jam.c index 9f9a10d..0ebda02 100644 --- a/jam.c +++ b/jam.c @@ -6,8 +6,11 @@ #include #include +unsigned short port = 2007; + const static struct option longopts[] = { { "destination-file", required_argument, NULL, 'd' }, + { "port", required_argument, NULL, 'p' }, { NULL, 0, NULL, 0 } }; @@ -21,11 +24,14 @@ void parse_options(int argc, char **argv) int option_index = 0; for ( ;; ) { - int c = getopt_long(argc, argv, "d:", longopts, &option_index); + int c = getopt_long(argc, argv, "d:p:", longopts, &option_index); switch (c) { case 'd': read_destination_list(optarg); break; + case 'p': + port = atoi(optarg); + break; case -1: return; // end of argument list default: @@ -99,7 +105,7 @@ int main(int argc, char **argv) int server_sock; parse_options(argc, argv); - server_sock = get_server_socket(2007); + server_sock = get_server_socket(port); // FIXME: fire off sender workers here