mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 14:22:31 -04: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
1 changed files with 27 additions and 10 deletions
|
@ -303,10 +303,20 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||||
|
|
||||||
/* THIS IS A HACK TO ALLOW WINDOWS TO ACCEPT COMMANDLINE ARGUMENTS */
|
/* THIS IS A HACK TO ALLOW WINDOWS TO ACCEPT COMMANDLINE ARGUMENTS */
|
||||||
|
|
||||||
const int MAX_ARGS = 32;
|
|
||||||
int i,j;
|
|
||||||
|
|
||||||
int argc;
|
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 *argv[MAX_ARGS];
|
||||||
char *wholeline = (char*)GetCommandLine();
|
char *wholeline = (char*)GetCommandLine();
|
||||||
int cmdlen = strlen(wholeline);
|
int cmdlen = strlen(wholeline);
|
||||||
|
@ -321,20 +331,27 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||||
argv[0] = dupline;
|
argv[0] = dupline;
|
||||||
for(i = 1, j = 0; (j + 1 < cmdlen) && (i < MAX_ARGS);)
|
for(i = 1, j = 0; (j + 1 < cmdlen) && (i < MAX_ARGS);)
|
||||||
{
|
{
|
||||||
/* find next space. */
|
/* find next space. */
|
||||||
for(;(j + 1 < cmdlen) && (dupline[j] != ' ');j++);
|
for(;(j + 1 < cmdlen) && (dupline[j] != ' ');j++);
|
||||||
if (j + 1 < cmdlen)
|
if (j + 1 < cmdlen)
|
||||||
{
|
{
|
||||||
dupline[j] = '\0';
|
dupline[j] = '\0';
|
||||||
argv[i++] = &(dupline[j+1]);
|
argv[i++] = &(dupline[j+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argc = i;
|
argc = i;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
for( i=0; i<argc; i++)
|
for( i=0; i<argc; i++)
|
||||||
{
|
{
|
||||||
printf("%d: %s\n", i, argv[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
|
#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
|
/* 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.
|
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)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue