mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
cleaned a bit the code in rsinit.cc
This commit is contained in:
parent
7ee0b4575e
commit
370d50b41a
@ -270,30 +270,20 @@ bool doPortRestrictions = false;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
#ifndef WINDOWS_SYS
|
||||
int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
|
||||
{
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
#else
|
||||
|
||||
/* for static PThreads under windows... we need to init the library...
|
||||
*/
|
||||
#ifdef WINDOWS_SYS
|
||||
#ifdef PTW32_STATIC_LIB
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck)
|
||||
int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
|
||||
{
|
||||
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
#ifdef WINDOWS_SYS
|
||||
/* THIS IS A HACK TO ALLOW WINDOWS TO ACCEPT COMMANDLINE ARGUMENTS */
|
||||
|
||||
int argc;
|
||||
int i;
|
||||
#ifdef USE_CMD_ARGS
|
||||
char** argv = argvIgnored;
|
||||
argc = argcIgnored;
|
||||
#else
|
||||
const int MAX_ARGS = 32;
|
||||
int j;
|
||||
char *argv[MAX_ARGS];
|
||||
@ -321,15 +311,13 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
argc = i;
|
||||
#endif
|
||||
|
||||
for( i=0; i<argc; i++)
|
||||
for(int i=0; i<argc; i++)
|
||||
printf("%d: %s\n", i, argv[i]);
|
||||
|
||||
/* for static PThreads under windows... we need to init the library...
|
||||
*/
|
||||
/* for static PThreads under windows... we need to init the library... */
|
||||
#ifdef PTW32_STATIC_LIB
|
||||
pthread_win32_process_attach_np();
|
||||
#endif
|
||||
#endif
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
|
||||
std::string prefUserString = "";
|
||||
@ -387,66 +375,8 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
if(!portRestrictions.empty()) doPortRestrictions = true;
|
||||
#endif
|
||||
|
||||
#ifdef SUSPENDED_CODE
|
||||
#ifdef LOCALNET_TESTING
|
||||
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:U:r:R:")) != -1)
|
||||
#else
|
||||
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:U:r:")) != -1)
|
||||
#endif
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
std::cerr << "Help: " << std::endl;
|
||||
std::cerr << "The commandline options are for retroshare-nogui, a headless server in a shell, or systems without QT." << std::endl << std::endl;
|
||||
std::cerr << "-l [logfile] Set the logfilename" << std::endl;
|
||||
std::cerr << "-w [password] Set the password" << std::endl;
|
||||
std::cerr << "-i [ip_adress] Set IP Adress to use" << std::endl;
|
||||
std::cerr << "-p [port] Set the Port to listen on" << std::endl;
|
||||
std::cerr << "-c [basedir] Set the config basdir" << std::endl;
|
||||
std::cerr << "-s Output to Stderr" << std::endl;
|
||||
std::cerr << "-d [debuglevel] Set the debuglevel" << std::endl;
|
||||
std::cerr << "-a AutoLogin (Windows Only) + StartMinimised" << std::endl;
|
||||
std::cerr << "-m StartMinimised" << std::endl;
|
||||
std::cerr << "-u Only listen to UDP" << std::endl;
|
||||
std::cerr << "-e Use a forwarded external Port" << std::endl ;
|
||||
std::cerr << "-U [User Name/GPG id/SSL id] Sets Account to Use, Useful when Autologin is enabled." << std::endl;
|
||||
std::cerr << "-r link Use RetroShare link." << std::endl;
|
||||
#ifdef LOCALNET_TESTING
|
||||
std::cerr << "-R <lport-uport> Port Restrictions." << std::endl;
|
||||
#endif
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
if (strictCheck) {
|
||||
std::cerr << "Unknown Option!" << std::endl;
|
||||
std::cerr << "Use '-h' for help." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
setOutputLevel((RsLog::logLvl)rsInitConfig->debugLevel);
|
||||
|
||||
// // set the default Debug Level...
|
||||
// if (rsInitConfig->haveDebugLevel)
|
||||
// {
|
||||
// if ((rsInitConfig->debugLevel > 0) &&
|
||||
// (rsInitConfig->debugLevel <= PQL_DEBUG_ALL))
|
||||
// {
|
||||
// std::cerr << "Setting Debug Level to: ";
|
||||
// std::cerr << rsInitConfig->debugLevel;
|
||||
// std::cerr << std::endl;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// std::cerr << "Ignoring Invalid Debug Level: ";
|
||||
// std::cerr << rsInitConfig->debugLevel;
|
||||
// std::cerr << std::endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
// set the debug file.
|
||||
if (rsInitConfig->haveLogFile)
|
||||
setDebugFile(rsInitConfig->logfname.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user