]> git.sesse.net Git - jam/commitdiff
Make the port configurable.
authorsgunderson@bigfoot.com <>
Wed, 31 Jan 2007 17:22:07 +0000 (18:22 +0100)
committersgunderson@bigfoot.com <>
Wed, 31 Jan 2007 17:22:07 +0000 (18:22 +0100)
jam.c

diff --git a/jam.c b/jam.c
index 9f9a10dbe7de611899f8fc9ce9bbe7c93d7ab3e9..0ebda023e129d58009959326714286fd19d3f5d6 100644 (file)
--- a/jam.c
+++ b/jam.c
@@ -6,8 +6,11 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 
+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