diff options
Diffstat (limited to 'erts/etc/common/erlexec.c')
| -rw-r--r-- | erts/etc/common/erlexec.c | 76 | 
1 files changed, 33 insertions, 43 deletions
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c index eaa94cd5e4..08e326b33b 100644 --- a/erts/etc/common/erlexec.c +++ b/erts/etc/common/erlexec.c @@ -23,14 +23,9 @@   * additions required for Windows NT.   */ -#ifdef HAVE_CONFIG_H -#  include "config.h" -#endif +#include "etc_common.h" -#include "sys.h"  #include "erl_driver.h" -#include <stdlib.h> -#include <stdarg.h>  #include "erl_misc_utils.h"  #ifdef __WIN32__ @@ -195,9 +190,7 @@ void error(char* format, ...);   * Local functions.   */ -#if !defined(ERTS_HAVE_SMP_EMU) || !defined(ERTS_HAVE_PLAIN_EMU)  static void usage_notsup(const char *switchname, const char *alt); -#endif  static char **build_args_from_env(char *env_var);  static char **build_args_from_string(char *env_var);  static void initial_argv_massage(int *argc, char ***argv); @@ -245,7 +238,7 @@ static int verbose = 0;		/* If non-zero, print some extra information. */  static int start_detached = 0;	/* If non-zero, the emulator should be  				 * started detached (in the background).  				 */ -static int start_smp_emu = 0;   /* Start the smp emulator. */ +static int start_smp_emu = 1;   /* Start the smp emulator. */  static const char* emu_type = 0; /* Type of emulator (lcnt, valgrind, etc) */  #ifdef __WIN32__ @@ -468,10 +461,6 @@ int main(int argc, char **argv)       * Construct the path of the executable.       */      cpuinfo = erts_cpu_info_create(); -    /* '-smp auto' is default */  -#ifdef ERTS_HAVE_SMP_EMU -    start_smp_emu = 1; -#endif  #if defined(__WIN32__) && defined(WIN32_ALWAYS_DEBUG)      emu_type = "debug"; @@ -503,23 +492,13 @@ int main(int argc, char **argv)  		    i++;  		smp_enable:                      ; -#if !defined(ERTS_HAVE_SMP_EMU) -		    usage_notsup("-smp enable", ""); -#endif  		} else if (strcmp(argv[i+1], "disable") == 0) {  		    i++;  		smp_disable: -#ifdef ERTS_HAVE_PLAIN_EMU -                    start_smp_emu = 0; -#else                      usage_notsup("-smp disable", " Use \"+S 1\" instead."); -#endif  		} else {  		smp:                      ; -#if !defined(ERTS_HAVE_SMP_EMU) -		    usage_notsup("-smp", ""); -#endif  		}  	    } else if (strcmp(argv[i], "-smpenable") == 0) {  		goto smp_enable; @@ -832,6 +811,28 @@ int main(int argc, char **argv)  		      add_Eargs(argv[i+1]);  		      i++;  		      break; +		  case 'I': +                      if (argv[i][2] == 'O' && (argv[i][3] == 't' || argv[i][3] == 'p')) { +                          if (argv[i][4] != '\0') +                              goto the_default; +                          argv[i][0] = '-'; +                          add_Eargs(argv[i]); +                          add_Eargs(argv[i+1]); +                          i++; +                          break; +                      } +                      if (argv[i][2] == 'O' && argv[i][3] == 'P' && +                          (argv[i][4] == 't' || argv[i][4] == 'p')) { +                          if (argv[i][5] != '\0') +                              goto the_default; +                          argv[i][0] = '-'; +                          add_Eargs(argv[i]); +                          add_Eargs(argv[i+1]); +                          i++; +                          break; +                      } +                      usage(argv[i]); +                      break;  		  case 'S':  		      if (argv[i][2] == 'P') {  			  if (argv[i][3] != '\0') @@ -887,8 +888,8 @@ int main(int argc, char **argv)  		  case 'c':  		      argv[i][0] = '-';  		      if (argv[i][2] == '\0' && i+1 < argc) { -			  if (sys_strcmp(argv[i+1], "true") == 0 -			      || sys_strcmp(argv[i+1], "false") == 0) { +			  if (strcmp(argv[i+1], "true") == 0 +			      || strcmp(argv[i+1], "false") == 0) {  			      add_Eargs(argv[i]);  			      add_Eargs(argv[i+1]);  			      i++; @@ -1160,15 +1161,6 @@ usage_aux(void)  #ifdef __WIN32__  	  "[-start_erl [datafile]] "  #endif -	  "[-smp [auto" -#ifdef ERTS_HAVE_SMP_EMU -	  "|enable" -#endif -#ifdef ERTS_HAVE_PLAIN_EMU -	  "|disable" -#endif -	  "]" -	  "] "  	  "[-make] [-man [manopts] MANPAGE] [-x] [-emu_args] [-start_epmd BOOLEAN] "  	  "[-args_file FILENAME] [+A THREADS] [+a SIZE] [+B[c|d|i]] [+c [BOOLEAN]] "  	  "[+C MODE] [+h HEAP_SIZE_OPTION] [+K BOOLEAN] " @@ -1189,14 +1181,12 @@ usage(const char *switchname)      usage_aux();  } -#if !defined(ERTS_HAVE_SMP_EMU) || !defined(ERTS_HAVE_PLAIN_EMU)  static void  usage_notsup(const char *switchname, const char *alt)  {      fprintf(stderr, "Argument \'%s\' not supported.%s\n", switchname, alt);      usage_aux();  } -#endif  static void  usage_format(char *format, ...) @@ -2195,18 +2185,18 @@ static WCHAR *utf8_to_utf16(unsigned char *bytes)      res = target = emalloc((num + 1) * sizeof(WCHAR));      while (*bytes) {  	if (((*bytes) & ((unsigned char) 0x80)) == 0) { -	    unipoint = (Uint) *bytes; +	    unipoint = (unsigned int) *bytes;  	    ++bytes;  	} else if (((*bytes) & ((unsigned char) 0xE0)) == 0xC0) {  	    unipoint =  -		(((Uint) ((*bytes) & ((unsigned char) 0x1F))) << 6) | -		((Uint) (bytes[1] & ((unsigned char) 0x3F))); 	 +		(((unsigned int) ((*bytes) & ((unsigned char) 0x1F))) << 6) | +		((unsigned int) (bytes[1] & ((unsigned char) 0x3F)));  	    bytes += 2;  	} else if (((*bytes) & ((unsigned char) 0xF0)) == 0xE0) {  	    unipoint =  -		(((Uint) ((*bytes) & ((unsigned char) 0xF))) << 12) | -		(((Uint) (bytes[1] & ((unsigned char) 0x3F))) << 6) | -		((Uint) (bytes[2] & ((unsigned char) 0x3F))); +		(((unsigned int) ((*bytes) & ((unsigned char) 0xF))) << 12) | +		(((unsigned int) (bytes[1] & ((unsigned char) 0x3F))) << 6) | +		((unsigned int) (bytes[2] & ((unsigned char) 0x3F)));  	    if (unipoint > 0xFFFF) {  		 unipoint = (unsigned int) '?';  	    } @@ -2225,7 +2215,7 @@ static WCHAR *utf8_to_utf16(unsigned char *bytes)  static int put_utf8(WCHAR ch, unsigned char *target, int sz, int *pos)  { -    Uint x = (Uint) ch; +    unsigned int x = (unsigned int) ch;      if (x < 0x80) {      if (*pos >= sz) {  	return -1;  | 
