Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6410 in orxonox.OLD for branches/preferences/src


Ignore:
Timestamp:
Jan 4, 2006, 7:50:52 PM (19 years ago)
Author:
rennerc
Message:

removed argp

Location:
branches/preferences/src
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/preferences/src/Makefile.am

    r6393 r6410  
    2626                       lib/gui/gl_gui/libORXglgui.a \
    2727                       lib/shell/libORXshell.a \
    28                        lib/network/libORXnet.a \
    29                        lib/argp/libargp.a
     28                       lib/network/libORXnet.a
    3029
    3130orxonox_LDADD = util/libORXutils.a \
     
    4645                lib/shell/libORXshell.a \
    4746                lib/network/libORXnet.a \
    48                 lib/argp/libargp.a \
    4947                $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    5048
  • branches/preferences/src/lib/Makefile.am

    r6393 r6410  
    1717                            parser/tinyxml/libtinyxml.a \
    1818                            parser/ini_parser/libIniParser.a \
    19                             shell/libORXshell.a \
    20                             argp/libargp.a
     19                            shell/libORXshell.a
    2120
    2221#libORXlibs_a_LIBDADD =     gui/gtk_gui/libORXgui.a \
     
    7776          shell \
    7877          gui \
    79           argp \
    8078          .
    8179
  • branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.cc

    r6403 r6410  
    2020using namespace std;
    2121
    22 static const argp_option   argp_options[] = {
    23   {"server",        's',        0,         0,   "Run as Server"},
    24   {"client",        'c',        0,         0,   "Run as Client"},
    25   {"host",          'h',        "ADDRESS", 0,   "Host to connect to"},
    26   {"port",          'p',        "PORT",    0,   "Port number"},
    27   {"user-config",   1000,       "FILE",    0,   "Location of config file" },
    28   { 0 }
    29 };
    30 
    31 const char* argp_program_version     = "orxonox";
    32 const char* argp_program_bug_address = "bugs@orxonox.net";
    33 static char doc[]                    = "doc goes here";
    34 static char args_doc[]               = "args doc goes here";
    35 
    36 static Argp argp = { argp_options, CmdLinePrefsReader::parse_opt, args_doc, doc };
    37 
    3822/**
    3923 * standard constructor
     
    4125CmdLinePrefsReader::CmdLinePrefsReader(int argc, char** argv)
    4226{
    43   //set default values
    44   cmdLineArgs.host       = NULL;
    45   cmdLineArgs.port       = NULL;
    46   cmdLineArgs.configFile = NULL;
    47   cmdLineArgs.isServer   = false;
    48   cmdLineArgs.isClient   = false;
    49 
    50 
    51   argp_parse((const struct argp *)&argp, (int)argc, (char**)argv, (unsigned)NULL, (int*)NULL, (void*)&(this->cmdLineArgs));
    52 
    53 
    54   PRINTF(0)("host       = %s\n", cmdLineArgs.host);
    55   PRINTF(0)("port       = %s\n", cmdLineArgs.port);
    56   PRINTF(0)("configfile = %s\n", cmdLineArgs.configFile);
    57   PRINTF(0)("server     = %d\n", cmdLineArgs.isServer);
    58   PRINTF(0)("client     = %d\n", cmdLineArgs.isClient);
    5927
    6028}
     
    6836}
    6937
    70 error_t CmdLinePrefsReader::parse_opt(int key, char *arg, ArgpState *state)
    71 {
    72   CmdLineArgs * cmdLineArgs = (CmdLineArgs*)(state->input);
    7338
    74   switch ( key )
    75   {
    76     case 1000:
    77       if ( cmdLineArgs->configFile!=NULL ) delete[] cmdLineArgs->configFile;
    78       cmdLineArgs->configFile = new char[strlen(arg)+1];
    79       strcpy(cmdLineArgs->configFile, arg);
    80       break;
    81 
    82     case 's':
    83       cmdLineArgs->isServer = true;
    84       break;
    85 
    86     case 'c':
    87       cmdLineArgs->isClient = true;
    88       break;
    89 
    90     case 'h':
    91       if ( cmdLineArgs->host!=NULL ) delete[] cmdLineArgs->host;
    92       cmdLineArgs->host = new char[strlen(arg)+1];
    93       strcpy(cmdLineArgs->host, arg);
    94       break;
    95 
    96     case 'p':
    97       if ( cmdLineArgs->port!=NULL ) delete[] cmdLineArgs->port;
    98       cmdLineArgs->port = new char[strlen(arg)+1];
    99       strcpy(cmdLineArgs->port, arg);
    100       break;
    101 
    102     default:
    103       return ARGP_ERR_UNKNOWN;
    104   }
    105 
    106   return 0;
    107 }
    108 
    109 
    110 
  • branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.h

    r6393 r6410  
    1010#include "debug.h"
    1111
    12 #include "src/lib/argp/argp.h"
    13 
    14 typedef struct {
    15   bool isServer;
    16   bool isClient;
    17   char * host;
    18   char * port;
    19   char * configFile;
    20 } CmdLineArgs;
    21 
    22 typedef struct argp Argp;
    23 typedef struct argp_state ArgpState;
    24 
    2512//! A class for reading commandline arguments into Preferences
    2613class CmdLinePrefsReader {
     
    3017   virtual ~CmdLinePrefsReader();
    3118
    32    static error_t parse_opt(int key, char *arg, ArgpState *state);
    33 
    34  private:
    35    CmdLineArgs cmdLineArgs;
    3619
    3720};
Note: See TracChangeset for help on using the changeset viewer.