mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 11:00:14 -05:00
checked in fix to cmd console rsinit.cc, pls test and get back to me
use USE_CMD_ARGS define in windows which enables use of cmd line console args git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3423 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e67412cc8c
commit
fd76e2ec4b
@ -303,10 +303,20 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
|
||||
/* THIS IS A HACK TO ALLOW WINDOWS TO ACCEPT COMMANDLINE ARGUMENTS */
|
||||
|
||||
const int MAX_ARGS = 32;
|
||||
int i,j;
|
||||
|
||||
|
||||
|
||||
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];
|
||||
char *wholeline = (char*)GetCommandLine();
|
||||
int cmdlen = strlen(wholeline);
|
||||
@ -321,20 +331,27 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
argv[0] = dupline;
|
||||
for(i = 1, j = 0; (j + 1 < cmdlen) && (i < MAX_ARGS);)
|
||||
{
|
||||
/* find next space. */
|
||||
for(;(j + 1 < cmdlen) && (dupline[j] != ' ');j++);
|
||||
if (j + 1 < cmdlen)
|
||||
{
|
||||
dupline[j] = '\0';
|
||||
argv[i++] = &(dupline[j+1]);
|
||||
}
|
||||
/* find next space. */
|
||||
for(;(j + 1 < cmdlen) && (dupline[j] != ' ');j++);
|
||||
if (j + 1 < cmdlen)
|
||||
{
|
||||
dupline[j] = '\0';
|
||||
argv[i++] = &(dupline[j+1]);
|
||||
}
|
||||
}
|
||||
argc = i;
|
||||
|
||||
#endif
|
||||
|
||||
for( i=0; i<argc; i++)
|
||||
{
|
||||
printf("%d: %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* for static PThreads under windows... we need to init the library...
|
||||
*/
|
||||
#ifdef PTW32_STATIC_LIB
|
||||
@ -349,7 +366,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
/* getopt info: every availiable option is listed here. if it is followed by a ':' it
|
||||
needs an argument. If it is followed by a '::' the argument is optional.
|
||||
*/
|
||||
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:U:")) != -1)
|
||||
while((c = getopt(argcIgnored, argvIgnored,"hesamui:p:c:w:l:d:U:")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user