@@ -368,7 +368,6 @@ extern const REBYTE Str_Banner[];
368
368
}
369
369
370
370
371
-
372
371
/***********************************************************************
373
372
**
374
373
*/ static void Init_Ops (void )
@@ -821,6 +820,27 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
821
820
REBCHR * data ;
822
821
REBCNT n ;
823
822
823
+ #ifdef RAW_MAIN_ARGS
824
+ REBSER * str ;
825
+ REBVAL * new ;
826
+ // make system/options/flags block even when not used...
827
+ val = Get_System (SYS_OPTIONS , OPTIONS_FLAGS );
828
+ Set_Block (val , Make_Block (3 ));
829
+ // clear list of default flags (system/catalog/boot-flags)
830
+ val = Get_System (SYS_CATALOG , CAT_BOOT_FLAGS );
831
+ SET_NONE (val );
832
+ // convert raw argument strings to block of strings...
833
+ ser = Make_Block (3 );
834
+ for (n = 1 ; n < rargs -> argc ; n ++ ) {
835
+ REBCHR * arg = rargs -> argv [n ];
836
+ if (arg == 0 ) continue ; // shell bug
837
+ new = Append_Value (ser );
838
+ Set_String (new , Copy_OS_Str (arg , (REBINT )LEN_STR (arg )));
839
+ //if(arg[0]=='-') VAL_SET_LINE(new);
840
+ }
841
+ val = Get_System (SYS_OPTIONS , OPTIONS_ARGS );
842
+ Set_Block (val , ser );
843
+ #else
824
844
825
845
ser = Make_Block (3 );
826
846
n = 2 ; // skip first flag (ROF_EXT)
@@ -830,8 +850,11 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
830
850
if (rargs -> options & n ) Append_Val (ser , val );
831
851
n <<= 1 ;
832
852
}
853
+ // last value is always TRUE, so it's possible to use just *path* instead of `find`
854
+ // like: `if system/options/flags/verbose [...]`
833
855
val = Append_Value (ser );
834
856
SET_TRUE (val );
857
+
835
858
val = Get_System (SYS_OPTIONS , OPTIONS_FLAGS );
836
859
Set_Block (val , ser );
837
860
@@ -846,16 +869,6 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
846
869
Set_Option_File (OPTIONS_SCRIPT , (REBYTE * )rargs -> script , FALSE);
847
870
}
848
871
849
- if (rargs -> exe_path ) {
850
- Set_Option_File (OPTIONS_BOOT , (REBYTE * )rargs -> exe_path , FALSE);
851
- }
852
-
853
- // Print("home: %s", rargs->home_dir);
854
- if (rargs -> home_dir ) {
855
- Set_Option_File (OPTIONS_HOME , (REBYTE * )rargs -> home_dir , TRUE);
856
- OS_FREE (rargs -> home_dir );
857
- }
858
-
859
872
n = Set_Option_Word (rargs -> boot , OPTIONS_BOOT_LEVEL );
860
873
if (n >= SYM_BASE && n <= SYM_MODS )
861
874
PG_Boot_Level = n - SYM_BASE ; // 0 - 3
@@ -867,7 +880,16 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
867
880
Set_Option_String (rargs -> import , OPTIONS_IMPORT );
868
881
869
882
Set_Option_Word (rargs -> secure , OPTIONS_SECURE );
883
+ #endif
884
+ if (rargs -> exe_path ) {
885
+ Set_Option_File (OPTIONS_BOOT , (REBYTE * )rargs -> exe_path , FALSE);
886
+ }
870
887
888
+ // Print("home: %s", rargs->home_dir);
889
+ if (rargs -> home_dir ) {
890
+ Set_Option_File (OPTIONS_HOME , (REBYTE * )rargs -> home_dir , TRUE);
891
+ OS_FREE (rargs -> home_dir );
892
+ }
871
893
if (NZ (data = OS_GET_LOCALE (0 ))) {
872
894
val = Get_System (SYS_LOCALE , LOCALE_LANGUAGE );
873
895
Set_String (val , Copy_OS_Str (data , (REBINT )LEN_STR (data )));
0 commit comments