Переглянути джерело

Z991239-385 #comment 将对spshell启动参数的处理放在日志初始化前并在日志中打印参数列表和版本号

gifur 5 роки тому
батько
коміт
78aa812bfe
4 змінених файлів з 123 додано та 112 видалено
  1. 1 1
      Version.rc.in
  2. 84 84
      libtoolkit/getopt.c
  3. 3 3
      libtoolkit/getopt.h
  4. 35 24
      spshell/spshell.cpp

+ 1 - 1
Version.rc.in

@@ -70,7 +70,7 @@ BEGIN
             VALUE "CompanyName", "@RC_VERSION_COMPANY@"
             VALUE "FileDescription", "@RC_VERSION_DESCRIPTION@"
             VALUE "FileVersion", "@RC_VERSION_MAJOR@.@RC_VERSION_MINOR@.@RC_VERSION_BUILD@.@RC_VERSION_PATCH@"
-            VALUE "LegalCopyright", "China Merchants Bank Co., Ltd Copyright (C) 2019-@RC_VERSION_YEAR@"
+            VALUE "LegalCopyright", "China Merchants Bank Copyright (C) 2019-@RC_VERSION_YEAR@"
             VALUE "ProductName", "@RC_VERSION_PRODUCT@"
             VALUE "ProductVersion", "@RC_VERSION_MAJOR@.@RC_VERSION_MINOR@.@RC_VERSION_BUILD@.@RC_VERSION_PATCH@"
         END

+ 84 - 84
libtoolkit/getopt.c

@@ -106,7 +106,7 @@
 	  Also, when `ordering' is RETURN_IN_ORDER,
 	  each non-option ARGV-element is returned here.  */
 
-char* getopt_optarg;
+char* optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -117,13 +117,13 @@ char* getopt_optarg;
    When `getopt' returns -1, this is the index of the first of the
    non-option elements that the caller should itself scan.
 
-   Otherwise, `getopt_optind' communicates from one call to the next
+   Otherwise, `optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
    /* 1003.2 says this must be 1 before any call.  */
-int getopt_optind = 1;
+int optind = 1;
 
-/* Formerly, initialization of getopt depended on getopt_optind==0, which
+/* Formerly, initialization of getopt depended on optind==0, which
    causes problems with re-calling getopt as programs generally don't
    know that. */
 
@@ -176,7 +176,7 @@ int optopt = '?';
 
    The special argument `--' forces an end of option-scanning regardless
    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
-   `--' can cause `getopt' to return -1 with `getopt_optind' != ARGC.  */
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
 
 static enum
 {
@@ -278,7 +278,7 @@ static int nonoption_flags_len;
 /* Exchange two adjacent subsequences of ARGV.
    One subsequence is elements [first_nonopt,last_nonopt)
    which contains all the non-options that have been skipped so far.
-   The other is elements [last_nonopt,getopt_optind), which contains all
+   The other is elements [last_nonopt,optind), which contains all
    the options processed since those non-options were skipped.
 
    `first_nonopt' and `last_nonopt' are relocated so that they describe
@@ -293,7 +293,7 @@ exchange(char** argv)
 {
 	int bottom = first_nonopt;
 	int middle = last_nonopt;
-	int top = getopt_optind;
+	int top = optind;
 	char* tem;
 
 	/* Exchange the shorter segment with the far end of the longer segment.
@@ -356,8 +356,8 @@ exchange(char** argv)
 
 	/* Update records for the slots the non-options now occupy.  */
 
-	first_nonopt += (getopt_optind - last_nonopt);
-	last_nonopt = getopt_optind;
+	first_nonopt += (optind - last_nonopt);
+	last_nonopt = optind;
 }
 
 /* Initialize the internal data when the first call is made.  */
@@ -371,7 +371,7 @@ static const char* _getopt_initialize(int argc, char* const* argv, const char* o
 	   is the program name); the sequence of previously skipped
 	   non-option ARGV-elements is empty.  */
 
-	first_nonopt = last_nonopt = getopt_optind;
+	first_nonopt = last_nonopt = optind;
 
 	nextchar = NULL;
 
@@ -432,11 +432,11 @@ static const char* _getopt_initialize(int argc, char* const* argv, const char* o
    from each of the option elements.
 
    If `getopt' finds another option character, it returns that character,
-   updating `getopt_optind' and `nextchar' so that the next call to `getopt' can
+   updating `optind' and `nextchar' so that the next call to `getopt' can
    resume the scan with the following option character or ARGV-element.
 
    If there are no more option characters, `getopt' returns -1.
-   Then `getopt_optind' is the index in ARGV of the first ARGV-element
+   Then `optind' is the index in ARGV of the first ARGV-element
    that is not an option.  (The ARGV-elements have been permuted
    so that those that are not options now come last.)
 
@@ -489,25 +489,25 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 	if (argc < 1)
 		return -1;
 
-	getopt_optarg = NULL;
+	optarg = NULL;
 
-	if (getopt_optind == 0 || !__getopt_initialized) {
-		if (getopt_optind == 0)
-			getopt_optind = 1;	/* Don't scan ARGV[0], the program name.  */
+	if (optind == 0 || !__getopt_initialized) {
+		if (optind == 0)
+			optind = 1;	/* Don't scan ARGV[0], the program name.  */
 		optstring = _getopt_initialize(argc, argv, optstring);
 		__getopt_initialized = 1;
 	}
 
-	/* Test whether ARGV[getopt_optind] points to a non-option argument.
+	/* Test whether ARGV[optind] points to a non-option argument.
 	   Either it does not have option syntax, or there is an environment flag
 	   from the shell indicating it is not an option.  The later information
 	   is only used when the used in the GNU libc.  */
 #if defined _LIBC && defined USE_NONOPTION_FLAGS
-# define NONOPTION_P (argv[getopt_optind][0] != '-' || argv[getopt_optind][1] == '\0'	      \
-		      || (getopt_optind < nonoption_flags_len			      \
-			  && __getopt_nonoption_flags[getopt_optind] == '1'))
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'	      \
+		      || (optind < nonoption_flags_len			      \
+			  && __getopt_nonoption_flags[optind] == '1'))
 #else
-# define NONOPTION_P (argv[getopt_optind][0] != '-' || argv[getopt_optind][1] == '\0')
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
 #endif
 
 	if (nextchar == NULL || *nextchar == '\0') {
@@ -515,26 +515,26 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 
 		/* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
 	   moved back by the user (who may also have changed the arguments).  */
-		if (last_nonopt > getopt_optind)
-			last_nonopt = getopt_optind;
-		if (first_nonopt > getopt_optind)
-			first_nonopt = getopt_optind;
+		if (last_nonopt > optind)
+			last_nonopt = optind;
+		if (first_nonopt > optind)
+			first_nonopt = optind;
 
 		if (ordering == PERMUTE) {
 			/* If we have just processed some options following some non-options,
 			   exchange them so that the options come first.  */
 
-			if (first_nonopt != last_nonopt && last_nonopt != getopt_optind)
+			if (first_nonopt != last_nonopt && last_nonopt != optind)
 				exchange((char**)argv);
-			else if (last_nonopt != getopt_optind)
-				first_nonopt = getopt_optind;
+			else if (last_nonopt != optind)
+				first_nonopt = optind;
 
 			/* Skip any additional non-options
 			   and extend the range of non-options previously skipped.  */
 
-			while (getopt_optind < argc && NONOPTION_P)
-				getopt_optind++;
-			last_nonopt = getopt_optind;
+			while (optind < argc && NONOPTION_P)
+				optind++;
+			last_nonopt = optind;
 		}
 
 		/* The special ARGV-element `--' means premature end of options.
@@ -542,26 +542,26 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 	   then exchange with previous non-options as if it were an option,
 	   then skip everything else like a non-option.  */
 
-		if (getopt_optind != argc && !strcmp(argv[getopt_optind], "--")) {
-			getopt_optind++;
+		if (optind != argc && !strcmp(argv[optind], "--")) {
+			optind++;
 
-			if (first_nonopt != last_nonopt && last_nonopt != getopt_optind)
+			if (first_nonopt != last_nonopt && last_nonopt != optind)
 				exchange((char**)argv);
 			else if (first_nonopt == last_nonopt)
-				first_nonopt = getopt_optind;
+				first_nonopt = optind;
 			last_nonopt = argc;
 
-			getopt_optind = argc;
+			optind = argc;
 		}
 
 		/* If we have done all the ARGV-elements, stop the scan
 	   and back over any non-options that we skipped and permuted.  */
 
-		if (getopt_optind == argc) {
+		if (optind == argc) {
 			/* Set the next-arg-index to point at the non-options
 			   that we previously skipped, so the caller will digest them.  */
 			if (first_nonopt != last_nonopt)
-				getopt_optind = first_nonopt;
+				optind = first_nonopt;
 			return -1;
 		}
 
@@ -571,15 +571,15 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 		if (NONOPTION_P) {
 			if (ordering == REQUIRE_ORDER)
 				return -1;
-			getopt_optarg = argv[getopt_optind++];
+			optarg = argv[optind++];
 			return 1;
 		}
 
 		/* We have found another option-ARGV-element.
 	   Skip the initial punctuation.  */
 
-		nextchar = (argv[getopt_optind] + 1
-			+ (longopts != NULL && argv[getopt_optind][1] == '-'));
+		nextchar = (argv[optind] + 1
+			+ (longopts != NULL && argv[optind][1] == '-'));
 	}
 
 	/* Decode the current option-ARGV-element.  */
@@ -598,8 +598,8 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 	   This distinction seems to be the most useful approach.  */
 
 	if (longopts != NULL
-		&& (argv[getopt_optind][1] == '-'
-			|| (long_only && (argv[getopt_optind][2] || !my_index(optstring, argv[getopt_optind][1]))))) {
+		&& (argv[optind][1] == '-'
+			|| (long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1]))))) {
 		char* nameend;
 		const struct option* p;
 		const struct option* pfound = NULL;
@@ -639,24 +639,24 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 		if (ambig && !exact) {
 			if (print_errors)
 				fprintf(stderr, _("%s: option `%s' is ambiguous\n"),
-					argv[0], argv[getopt_optind]);
+					argv[0], argv[optind]);
 			nextchar += strlen(nextchar);
-			getopt_optind++;
+			optind++;
 			optopt = 0;
 			return '?';
 		}
 
 		if (pfound != NULL) {
 			option_index = indfound;
-			getopt_optind++;
+			optind++;
 			if (*nameend) {
 				/* Don't test has_arg with >, because some C compilers don't
 			   allow it to be used on enums.  */
 				if (pfound->has_arg)
-					getopt_optarg = nameend + 1;
+					optarg = nameend + 1;
 				else {
 					if (print_errors) {
-						if (argv[getopt_optind - 1][1] == '-')
+						if (argv[optind - 1][1] == '-')
 							/* --option */
 							fprintf(stderr,
 								_("%s: option `--%s' doesn't allow an argument\n"),
@@ -665,7 +665,7 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 							/* +option or -option */
 							fprintf(stderr,
 								_("%s: option `%c%s' doesn't allow an argument\n"),
-								argv[0], argv[getopt_optind - 1][0], pfound->name);
+								argv[0], argv[optind - 1][0], pfound->name);
 					}
 
 					nextchar += strlen(nextchar);
@@ -675,13 +675,13 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 				}
 			}
 			else if (pfound->has_arg == 1) {
-				if (getopt_optind < argc)
-					getopt_optarg = argv[getopt_optind++];
+				if (optind < argc)
+					optarg = argv[optind++];
 				else {
 					if (print_errors)
 						fprintf(stderr,
 							_("%s: option `%s' requires an argument\n"),
-							argv[0], argv[getopt_optind - 1]);
+							argv[0], argv[optind - 1]);
 					nextchar += strlen(nextchar);
 					optopt = pfound->val;
 					return optstring[0] == ':' ? ':' : '?';
@@ -701,20 +701,20 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 	   or the option starts with '--' or is not a valid short
 	   option, then it's an error.
 	   Otherwise interpret it as a short option.  */
-		if (!long_only || argv[getopt_optind][1] == '-'
+		if (!long_only || argv[optind][1] == '-'
 			|| my_index(optstring, *nextchar) == NULL) {
 			if (print_errors) {
-				if (argv[getopt_optind][1] == '-')
+				if (argv[optind][1] == '-')
 					/* --option */
 					fprintf(stderr, _("%s: unrecognized option `--%s'\n"),
 						argv[0], nextchar);
 				else
 					/* +option or -option */
 					fprintf(stderr, _("%s: unrecognized option `%c%s'\n"),
-						argv[0], argv[getopt_optind][0], nextchar);
+						argv[0], argv[optind][0], nextchar);
 			}
 			nextchar = (char*)"";
-			getopt_optind++;
+			optind++;
 			optopt = 0;
 			return '?';
 		}
@@ -726,9 +726,9 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 		char c = *nextchar++;
 		char* temp = my_index(optstring, c);
 
-		/* Increment `getopt_optind' when we start to process its last character.  */
+		/* Increment `optind' when we start to process its last character.  */
 		if (*nextchar == '\0')
-			++getopt_optind;
+			++optind;
 
 		if (temp == NULL || c == ':') {
 			if (print_errors) {
@@ -755,12 +755,12 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 
 			/* This is an option that requires an argument.  */
 			if (*nextchar != '\0') {
-				getopt_optarg = nextchar;
+				optarg = nextchar;
 				/* If we end this ARGV-element by taking the rest as an arg,
 				   we must advance to the next element now.  */
-				getopt_optind++;
+				optind++;
 			}
-			else if (getopt_optind == argc) {
+			else if (optind == argc) {
 				if (print_errors) {
 					/* 1003.2 specifies the format of this message.  */
 					fprintf(stderr, _("%s: option requires an argument -- %c\n"),
@@ -774,14 +774,14 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 				return c;
 			}
 			else
-				/* We already incremented `getopt_optind' once;
+				/* We already incremented `optind' once;
 				   increment it again when taking next ARGV-elt as argument.  */
-				getopt_optarg = argv[getopt_optind++];
+				optarg = argv[optind++];
 
-			/* getopt_optarg is now the argument, see if it's in the
+			/* optarg is now the argument, see if it's in the
 			   table of longopts.  */
 
-			for (nextchar = nameend = getopt_optarg; *nameend && *nameend != '='; nameend++)
+			for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
 				/* Do nothing.  */;
 
 			/* Test all long options for either exact match
@@ -807,9 +807,9 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 			if (ambig && !exact) {
 				if (print_errors)
 					fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"),
-						argv[0], argv[getopt_optind]);
+						argv[0], argv[optind]);
 				nextchar += strlen(nextchar);
-				getopt_optind++;
+				optind++;
 				return '?';
 			}
 			if (pfound != NULL) {
@@ -818,7 +818,7 @@ _getopt_internal(int argc, char* const* argv, const char* optstring,
 					/* Don't test has_arg with >, because some C compilers don't
 					   allow it to be used on enums.  */
 					if (pfound->has_arg)
-						getopt_optarg = nameend + 1;
+						optarg = nameend + 1;
 					else {
 						if (print_errors)
 							fprintf(stderr, _("\
@@ -830,13 +830,13 @@ argv[0], pfound->name);
 					}
 				}
 				else if (pfound->has_arg == 1) {
-					if (getopt_optind < argc)
-						getopt_optarg = argv[getopt_optind++];
+					if (optind < argc)
+						optarg = argv[optind++];
 					else {
 						if (print_errors)
 							fprintf(stderr,
 								_("%s: option `%s' requires an argument\n"),
-								argv[0], argv[getopt_optind - 1]);
+								argv[0], argv[optind - 1]);
 						nextchar += strlen(nextchar);
 						return optstring[0] == ':' ? ':' : '?';
 					}
@@ -857,22 +857,22 @@ argv[0], pfound->name);
 			if (temp[2] == ':') {
 				/* This is an option that accepts an argument optionally.  */
 				if (*nextchar != '\0') {
-					getopt_optarg = nextchar;
-					getopt_optind++;
+					optarg = nextchar;
+					optind++;
 				}
 				else
-					getopt_optarg = NULL;
+					optarg = NULL;
 				nextchar = NULL;
 			}
 			else {
 				/* This is an option that requires an argument.  */
 				if (*nextchar != '\0') {
-					getopt_optarg = nextchar;
+					optarg = nextchar;
 					/* If we end this ARGV-element by taking the rest as an arg,
 					   we must advance to the next element now.  */
-					getopt_optind++;
+					optind++;
 				}
-				else if (getopt_optind == argc) {
+				else if (optind == argc) {
 					if (print_errors) {
 						/* 1003.2 specifies the format of this message.  */
 						fprintf(stderr,
@@ -886,9 +886,9 @@ argv[0], pfound->name);
 						c = '?';
 				}
 				else
-					/* We already incremented `getopt_optind' once;
+					/* We already incremented `optind' once;
 				   increment it again when taking next ARGV-elt as argument.  */
-					getopt_optarg = argv[getopt_optind++];
+					optarg = argv[optind++];
 				nextchar = NULL;
 			}
 		}
@@ -932,7 +932,7 @@ char** argv;
 	int digit_optind = 0;
 
 	while (1) {
-		int this_option_optind = getopt_optind ? getopt_optind : 1;
+		int this_option_optind = optind ? optind : 1;
 
 		c = getopt(argc, argv, "abc:d:0123456789");
 		if (c == -1)
@@ -964,7 +964,7 @@ char** argv;
 			break;
 
 		case 'c':
-			printf("option c with value '%s'\n", getopt_optarg);
+			printf("option c with value '%s'\n", optarg);
 			break;
 
 		case '?':
@@ -975,10 +975,10 @@ char** argv;
 		}
 	}
 
-	if (getopt_optind < argc) {
+	if (optind < argc) {
 		printf("non-option ARGV-elements: ");
-		while (getopt_optind < argc)
-			printf("%s ", argv[getopt_optind++]);
+		while (optind < argc)
+			printf("%s ", argv[optind++]);
 		printf("\n");
 	}
 

+ 3 - 3
libtoolkit/getopt.h

@@ -46,7 +46,7 @@ extern "C" {
        Also, when `ordering' is RETURN_IN_ORDER,
        each non-option ARGV-element is returned here.  */
 
-    TOOLKIT_API char* getopt_optarg;
+    TOOLKIT_API char* optarg;
 
     /* Index in ARGV of the next element to be scanned.
        This is used for communication to and from the caller
@@ -57,10 +57,10 @@ extern "C" {
        When `getopt' returns -1, this is the index of the first of the
        non-option elements that the caller should itself scan.
 
-       Otherwise, `getopt_optind' communicates from one call to the next
+       Otherwise, `optind' communicates from one call to the next
        how much of ARGV has been scanned so far.  */
 
-    TOOLKIT_API int getopt_optind;
+    TOOLKIT_API int optind;
 
     /* Callers store zero here to inhibit the error message `getopt' prints
        for unrecognized options.  */

+ 35 - 24
spshell/spshell.cpp

@@ -748,7 +748,7 @@ void DisplayUsage()
 		"  --ipc <pipe,tcp>                      -- pipe: 实体间以管道的方式通信;tcp: 实体间以socket的方式通信\n"
 	);
 
-	sp_dbg_info(szHelp);
+	//sp_dbg_info(szHelp);
 #ifdef _WIN32
 	MessageBoxA(NULL, szHelp, "Spshell Usage Tip", MB_OK);
 #else
@@ -756,15 +756,15 @@ void DisplayUsage()
 #endif //_WIN32
 }
 
-const char* GetVersionFullString()
+const char* GetFullVersionString(bool logFlag = false)
 {
 	static char szVersion[128] = {'\0'};
 	if (strlen(szVersion) == 0) {
 		CVersion spbase_version;
 		GetLibVersion(spbase_version);
-		sprintf_s(szVersion, 128, "spbase version: %s(build date: %s)\n"
-			"libtoolkit version: %s\n", 
-			spbase_version.ToString().GetData(), GetLibBuildDate(),
+		sprintf_s(szVersion, 128, "spbase version: %s(build date: %s)%s"
+			"libtoolkit version: %s", 
+			spbase_version.ToString().GetData(), GetLibBuildDate(), logFlag ? " " : "\n",
 			toolkit_version_string());
 	}
 	return szVersion;
@@ -796,9 +796,9 @@ sp_cfg_start_args_t* DealWithArgs(int argc, char** argv)
 		switch (c) {
 		case 'E':
 		{
-			sp_dbg_info("start specified entity: %s", getopt_optarg);
-			if (getopt_optarg != NULL) {
-				const int len = strlen(getopt_optarg);
+			//sp_dbg_info("start specified entity: %s", optarg);
+			if (optarg != NULL) {
+				const int len = strlen(optarg);
 				if (args->start_entities == NULL || len + strlen(args->start_entities) + 2 /*;\0*/ >= allocedEntitiyLen) {
 					if (args->start_entities == NULL) {
 						assert(allocedEntitiyLen == 0);
@@ -822,33 +822,33 @@ sp_cfg_start_args_t* DealWithArgs(int argc, char** argv)
 						allocedEntitiyLen = newLen;
 					}
 				}
-				strcat(args->start_entities, getopt_optarg);
+				strcat(args->start_entities, optarg);
 				strcat(args->start_entities, ";");
 			}
 		}
 		break;
 		case 'G':
-			sp_dbg_info("run spshell as guardian mode!");
+			//sp_dbg_info("run spshell as guardian mode!");
 			args->guardian_mode = 1;
 			break;
 		case 'D':
-			sp_dbg_info("run spshell as debug mode!");
+			//sp_dbg_info("run spshell as debug mode!");
 			args->debug_mode = 1;
 			break;
 		case 'T':
-			sp_dbg_info("run spshell as test mode!");
+			//sp_dbg_info("run spshell as test mode!");
 			args->test_mode = 1;
 			break;
 		case 'I':
-			sp_dbg_info("run spshell with specified ipc method: %s", getopt_optarg);
-			if (getopt_optarg) {
-				if (strnicmp(getopt_optarg, "tcp", strlen("tcp")) == 0)
+			//sp_dbg_info("run spshell with specified ipc method: %s", optarg);
+			if (optarg) {
+				if (strnicmp(optarg, "tcp", strlen("tcp")) == 0)
 					args->ipc_type = 1;
 			}
 			break;
 		case 'K':
 		{
-			sp_dbg_info("terminate spshell!");
+			//sp_dbg_info("terminate spshell!");
 			char* relate_processes[] = {
 #ifdef _WIN32
 			 "spshell.exe", "sphost.exe", "guardian.exe"
@@ -863,9 +863,9 @@ sp_cfg_start_args_t* DealWithArgs(int argc, char** argv)
 		case 'V':
 		{
 #ifdef _WIN32
-			MessageBoxA(NULL, GetVersionFullString(), "Spshell", MB_OK);
+			MessageBoxA(NULL, GetFullVersionString(), "Spshell", MB_OK);
 #else
-			printf(GetVersionFullString());
+			printf("%s\n", GetFullVersionString());
 #endif //_WIN32
 			exit(0);
 		}
@@ -879,10 +879,12 @@ sp_cfg_start_args_t* DealWithArgs(int argc, char** argv)
 		}
 	}
 
-	if (getopt_optind < argc) {
-		sp_dbg_warn("non-option ARGV-elements: ");
-		while (getopt_optind < argc)
-			sp_dbg_warn("\t%s", argv[getopt_optind++]);
+	if (optind < argc) {
+		//sp_dbg_warn("non-option ARGV-elements: ");
+		while (optind < argc) {
+			//sp_dbg_warn("\t%s", argv[optind++]);
+		}
+			
 	}
 
 	if (args && args->start_entities != 0) {
@@ -894,6 +896,9 @@ sp_cfg_start_args_t* DealWithArgs(int argc, char** argv)
 
 int main(int argc, char** argv)
 {
+
+	sp_cfg_start_args_t* args = DealWithArgs(argc, argv);
+
 	WLog_initRVC("SpShell");
 
 #ifdef _WIN32
@@ -901,8 +906,14 @@ int main(int argc, char** argv)
 #endif //_WIN32
 	sp_dbg_init("SpShell");
 	sp_dbg_info("===================SpShell start=====================");
-		
-	sp_cfg_start_args_t* args = DealWithArgs(argc, argv);
+	if (argc > 1) {
+		char cmdline[1024] = { '\0' };
+		for (int i = 0; i < argc; ++i) {
+			sprintf_s(cmdline, 1024, "%s %s", cmdline, argv[i]);
+		}
+		sp_dbg_info(cmdline);
+	}
+	sp_dbg_info(GetFullVersionString(true));
 
 	char proc1[64] = { '\0' };
 	char proc2[64] = { '\0' };