#include <stdio.h>
#include <stdlib.h>
+#include <getopt.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netinet/in.h>
+const static struct option longopts[] = {
+ { "destination-file", required_argument, NULL, 'd' },
+ { NULL, 0, NULL, 0 }
+};
+
+void read_destination_list(char *filename)
+{
+
+}
+
+void parse_options(int argc, char **argv)
+{
+ int option_index = 0;
+
+ for ( ;; ) {
+ int c = getopt_long(argc, argv, "d:", longopts, &option_index);
+ switch (c) {
+ case 'd':
+ read_destination_list(optarg);
+ break;
+ case -1:
+ return; // end of argument list
+ default:
+ fprintf(stderr, "Invalid option\n");
+ exit(1);
+ }
+ }
+}
+
void *receiver_worker(void *arg)
{
int sock = (int)arg;
return server_sock;
}
-int main()
+int main(int argc, char **argv)
{
- int server_sock = get_server_socket(2007);
+ int server_sock;
+
+ parse_options(argc, argv);
+ server_sock = get_server_socket(2007);
// FIXME: fire off sender workers here