Index: branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.cc
===================================================================
--- branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.cc	(revision 6391)
+++ branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.cc	(revision 6392)
@@ -20,10 +20,41 @@
 using namespace std;
 
+static const argp_option   argp_options[] = {
+  {"server",        's',        0,         0,   "Run as Server"},
+  {"client",        'c',        0,         0,   "Run as Client"},
+  {"host",          'h',        "ADDRESS", 0,   "Host to connect to"},
+  {"port",          'p',        "PORT",    0,   "Port number"},
+  {"user-config",   1000,       "FILE",    0,   "Location of config file" },
+  { 0 }
+};
+
+const char* argp_program_version     = "orxonox";
+const char* argp_program_bug_address = "bugs@orxonox.net";
+static char doc[]                    = "doc goes here";
+static char args_doc[]               = "args doc goes here";
+
+static Argp argp = { argp_options, CmdLinePrefsReader::parse_opt, args_doc, doc };
 
 /**
  * standard constructor
 */
-CmdLinePrefsReader::CmdLinePrefsReader ()
+CmdLinePrefsReader::CmdLinePrefsReader(int argc, char** argv)
 {
+  //set default values
+  cmdLineArgs.host       = NULL;
+  cmdLineArgs.port       = NULL;
+  cmdLineArgs.configFile = NULL;
+  cmdLineArgs.isServer   = false;
+  cmdLineArgs.isClient   = false;
+
+  argp_parse(&argp, argc, argv, 0, 0, &(this->cmdLineArgs));
+
+
+  PRINTF(0)("host       = %s\n", cmdLineArgs.host);
+  PRINTF(0)("port       = %s\n", cmdLineArgs.port);
+  PRINTF(0)("configfile = %s\n", cmdLineArgs.configFile);
+  PRINTF(0)("server     = %d\n", cmdLineArgs.isServer);
+  PRINTF(0)("client     = %d\n", cmdLineArgs.isClient);
+
 }
 
@@ -36,3 +67,43 @@
 }
 
+error_t CmdLinePrefsReader::parse_opt(int key, char *arg, ArgpState *state)
+{
+  CmdLineArgs * cmdLineArgs = (CmdLineArgs*)(state->input);
 
+  switch ( key )
+  {
+    case 1000:
+      if ( cmdLineArgs->configFile!=NULL ) delete[] cmdLineArgs->configFile;
+      cmdLineArgs->configFile = new char[strlen(arg)+1];
+      strcpy(cmdLineArgs->configFile, arg);
+      break;
+
+    case 's':
+      cmdLineArgs->isServer = true;
+      break;
+
+    case 'c':
+      cmdLineArgs->isClient = true;
+      break;
+
+    case 'h':
+      if ( cmdLineArgs->host!=NULL ) delete[] cmdLineArgs->host;
+      cmdLineArgs->host = new char[strlen(arg)+1];
+      strcpy(cmdLineArgs->host, arg);
+      break;
+
+    case 'p':
+      if ( cmdLineArgs->port!=NULL ) delete[] cmdLineArgs->port;
+      cmdLineArgs->port = new char[strlen(arg)+1];
+      strcpy(cmdLineArgs->port, arg);
+      break;
+
+    default:
+      return ARGP_ERR_UNKNOWN;
+  }
+
+  return 0;
+}
+
+
+
Index: branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.h
===================================================================
--- branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.h	(revision 6391)
+++ branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.h	(revision 6392)
@@ -7,12 +7,31 @@
 #define _CMD_LINE_PREFS_READER_H
 
+#include "stdincl.h"
+#include "debug.h"
+
+#include <argp.h>
+
+typedef struct {
+  bool isServer;
+  bool isClient;
+  char * host;
+  char * port;
+  char * configFile;
+} CmdLineArgs;
+
+typedef struct argp Argp;
+typedef struct argp_state ArgpState;
+
 //! A class for reading commandline arguments into Preferences
 class CmdLinePrefsReader {
 
  public:
-   CmdLinePrefsReader();
+   CmdLinePrefsReader(int argc, char** argv);
    virtual ~CmdLinePrefsReader();
 
+   static error_t parse_opt(int key, char *arg, ArgpState *state);
+
  private:
+   CmdLineArgs cmdLineArgs;
 
 };
Index: branches/preferences/src/orxonox.cc
===================================================================
--- branches/preferences/src/orxonox.cc	(revision 6391)
+++ branches/preferences/src/orxonox.cc	(revision 6392)
@@ -57,4 +57,6 @@
 
 #include "network_manager.h"
+
+#include "lib/parser/preferences/cmd_line_prefs_reader.h"
 
 #include <string.h>
@@ -398,5 +400,7 @@
 int main(int argc, char** argv)
 {
-  int i;
+  CmdLinePrefsReader prefs(argc, argv);
+
+  /*int i;
   for(i = 1; i < argc; ++i)
   {
@@ -411,7 +415,8 @@
     else if(!strcmp( "--license", argv[i])  || !strcmp("-s", argv[i]))
       return PRINT(0)(ORXONOX_LICENSE_SHORT);
-  }
-
-  return startOrxonox(argc, argv, NULL, -1);
+}
+
+  return startOrxonox(argc, argv, NULL, -1);*/
+  return 0;
 }
 
