-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josep M. Bach
committed
Sep 20, 2012
1 parent
0365848
commit e65c81a
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
#include <shitdb/db.h> | ||
#include <shitdb/server.h> | ||
|
||
#define DEFAULT_PORT 4999 | ||
|
||
static int | ||
resolve_port(int argc, char **argv) | ||
{ | ||
int port = 0; | ||
if(argc == 2 && (port = atoi(argv[1]))) { | ||
return port; | ||
} else { | ||
return DEFAULT_PORT; | ||
} | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
DB *db = DB_create(); | ||
|
||
Server_start(db, DEFAULT_PORT); | ||
int port = resolve_port(argc, argv); | ||
|
||
Server_start(db, port); | ||
|
||
return 0; | ||
} |