Skip to content

Commit

Permalink
Fixed @SMonaghan's mistakes... Also added server help flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
amygara committed Apr 29, 2015
1 parent 55df535 commit de19695
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
4 changes: 3 additions & 1 deletion server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#* GW KV
#* https://github.com/gwAdvNet2015/gw-kv-store
#*
#* Copyright 2015 Phil Lopreiato
#* Copyright 2015 Phil Lopreiato, Neel Shah,
#* Eric Armbrust, Chenghu He, Wenhui Zhang,
#* Wei Zhang, Pradeep Kumar
#*
#* This program is licensed under the MIT license.
#*
Expand Down
2 changes: 1 addition & 1 deletion server/handle_operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* GW KV
* https://github.com/gwAdvNet2015/gw-kv-store
*
* Copyright 2015 Phil Lopreiato Neel Shah
* Copyright 2015 Neel Shah
*
* This program is licensed under the MIT license.
*
Expand Down
2 changes: 1 addition & 1 deletion server/handle_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* GW KV
* https://github.com/gwAdvNet2015/gw-kv-store
*
* Copyright 2015 Phil Lopreiato
* Copyright 2015 Neel Shah
*
* This program is licensed under the MIT license.
*
Expand Down
25 changes: 13 additions & 12 deletions server/server-kv-run.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
* GW KV
* https://github.com/gwAdvNet2015/gw-kv-store
*
* Copyright 2015 Tim Wood, Phil Lopreiato
* Copyright 2015 Tim Wood, Phil Lopreiato,
* Eric Armbrust, Neel Shah
*
* This program is licensed under the MIT license.
*
* A little help from:
* http://beej.us/guide/bgnet/
*
* server_kv_run.c - Starts the server
*************************************************/

Expand All @@ -27,11 +31,6 @@
#include "gwkv_ht_wrapper.h"
#include "../lib/hashtable/hashtable.h"

/****************************************
Author: Tim Wood
with a little help from
http://beej.us/guide/bgnet/
****************************************/

int
main(int argc, char ** argv)
Expand All @@ -41,12 +40,7 @@ main(int argc, char ** argv)
int sockfd;
int o;

/* Command line args:
-p port
-n thread number
-d verbose output
*/
while ((o = getopt (argc, argv, "p:n:d")) != -1) {
while ((o = getopt (argc, argv, "p:n:d:h")) != -1) {
switch(o){
case 'p':
server_port = optarg;
Expand All @@ -58,6 +52,13 @@ main(int argc, char ** argv)
verbose_print = 1;
kvprintf("[!] verbose mode enabled\n");
break;
case 'h':
printf("Command line args:\n"
"\t -p port\n"
"\t -n number of threads\n"
"\t -d verbose output\n"
"\t -h this menu\n");
break;
case '?':
if(optopt == 'p') {
fprintf (stderr, "Option %c requires an argument.\n", optopt);
Expand Down
14 changes: 7 additions & 7 deletions server/server-kv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
* GW KV
* https://github.com/gwAdvNet2015/gw-kv-store
*
* Copyright 2015 Tim Wood, Phil Lopreiato
* Copyright 2015 Tim Wood, Eric Armbrust,
* Wei Zhang, Wenhui Zhang, Neel Shah,
* Chenghu He
*
* With a little help from
* http://beej.us/guide/bgnet/
*
* This program is licensed under the MIT license.
*
Expand All @@ -14,23 +19,18 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>

#include <netdb.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include <arpa/inet.h>
#include <pthread.h>

#include "server-kv.h"
#include "gwkv_ht_wrapper.h"
#include "handle_operation.h"
#include "../lib/hashtable/hashtable.h"

/****************************************
Author: Tim Wood
with a little help from
http://beej.us/guide/bgnet/
****************************************/

struct pool_list *list_head = NULL, *list_tail = NULL;

Expand Down
4 changes: 3 additions & 1 deletion server/server-kv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* GW KV
* https://github.com/gwAdvNet2015/gw-kv-store
*
* Copyright 2015 Tim Wood, Phil Lopreiato
* Copyright 2015 Tim Wood, Eric Armbrust,
* Neel Shah, Wei Zhang, Chenghu He,
* Wenhui Zhang
*
* This program is licensed under the MIT license.
*
Expand Down

0 comments on commit de19695

Please sign in to comment.