diff options
author | 2008-11-20 12:16:30 -0500 | |
---|---|---|
committer | 2008-11-20 12:16:30 -0500 | |
commit | bb90d8a1a4c89477565d4da98716b6d0c855a324 (patch) | |
tree | 2a5822346670938e7d1be8b131e9a0b7d3959408 /src/c/driver.c | |
parent | eb171fceba46cbe600d8e29adc526e86719cdc4f (diff) |
Profiling support
Diffstat (limited to 'src/c/driver.c')
-rw-r--r-- | src/c/driver.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/c/driver.c b/src/c/driver.c index f80361b1..ce0d194e 100644 --- a/src/c/driver.c +++ b/src/c/driver.c @@ -1,10 +1,12 @@ #include <stdio.h> #include <string.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> +#include <signal.h> #include <pthread.h> @@ -297,6 +299,11 @@ static void help(char *cmd) { printf("Usage: %s [-p <port>] [-t <thread-count>]\n", cmd); } +static void sigint(int signum) { + printf("Exiting....\n"); + exit(0); +} + int main(int argc, char *argv[]) { // The skeleton for this function comes from Beej's sockets tutorial. int sockfd; // listen on sock_fd @@ -304,7 +311,9 @@ int main(int argc, char *argv[]) { struct sockaddr_in their_addr; // connector's address information int sin_size, yes = 1; int uw_port = 8080, nthreads = 1, i, *names, opt; - + + signal(SIGINT, sigint); + while ((opt = getopt(argc, argv, "hp:t:")) != -1) { switch (opt) { case '?': |