]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/ContextTool/org/tianocore/context/ParseParameter.java
Fix the bug EDKT464. ? and * are regarded as wildcard char by OS. so we have to remov...
[mirror_edk2.git] / Tools / Java / Source / ContextTool / org / tianocore / context / ParseParameter.java
index 6b210ec1af265a27fef5c4dd8fc2e60ba1b0b493..24adfb70f1f21f88a5f448a4d235a8a04374d29b 100644 (file)
@@ -29,13 +29,12 @@ public class ParseParameter {
             return false;\r
         } else {\r
             if( (args[0].compareToIgnoreCase("-h") == 0) || (args[0].compareToIgnoreCase("/h") == 0) || \r
-                (args[0].compareToIgnoreCase("-?") == 0) || (args[0].compareToIgnoreCase("/?") == 0) || \r
-                (args[0].compareToIgnoreCase("-help") == 0) || (args[0].compareToIgnoreCase("/help") == 0) ){\r
+                (args[0].compareToIgnoreCase("--help") == 0) || (args[0].compareToIgnoreCase("/help") == 0) ){\r
                 HelpInfo.outputUsageInfo();\r
                 return false;\r
             }\r
             if( args[0].charAt(0) != '-' ){\r
-                System.out.printf("%s\n", "Error arguments! Please type \"ContextTool -h\" for helpinfo.");\r
+                System.out.printf("%s\n", "Error Parameters! Please type \"ContextTool -h\" for helpinfo.");\r
                 return false;\r
             }\r
             for(int i=0; i<args.length; i++){\r
@@ -43,7 +42,7 @@ public class ParseParameter {
                     ((args[i].compareTo("-a") != 0) && (args[i].compareTo("-c") != 0) && \r
                     (args[i].compareTo("-n") != 0) && (args[i].compareTo("-p") != 0) && \r
                     (args[i].compareTo("-t") != 0) && (args[i].compareTo("-m") != 0)))){\r
-                    System.out.printf("%s\n", "Error arguments! Please type \"ContextTool -h\" for helpinfo.");                                                                                                                                                            \r
+                    System.out.printf("%s\n", "Error Parameters! Please type \"ContextTool -h\" for helpinfo.");                                                                                                                                                            \r
                     return false;\r
                 }\r
             }\r
@@ -86,7 +85,8 @@ public class ParseParameter {
                 //argstr is "-p ? ", display possible setting\r
                 //\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
-                    System.out.printf( "%s\n", "assign the platform FPD file's relative path to WORKSPACE" );\r
+                    String workspacePath = System.getenv("WORKSPACE");\r
+                    System.out.printf( "%s\n", "Assign a platform FPD file with relative path to " + workspacePath);\r
                     return 2;\r
                 }\r
                 //\r
@@ -99,7 +99,7 @@ public class ParseParameter {
                 }\r
                 String[] S = argstr.split(" ");\r
                 if(S.length > 2){\r
-                    System.out.printf( "%s\n", "The number of ACTIVE_PLATFORM can not more than 1.");\r
+                    System.out.printf( "%s\n", "There should be none or only one ACTIVE_PLATFORM. Please check the number of value which follow \"-p\".");\r
                     return 3;\r
                 }\r
                 curpstr = pstr.concat(argstr.substring(2));\r
@@ -110,7 +110,7 @@ public class ParseParameter {
                     return 1;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
-                    System.out.printf( "%s\n", "What kind of the version is the binary target, such as DEBUG, RELEASE" );\r
+                    System.out.printf( "%s\n", "What kind of the version is the binary target, such as DEBUG, RELEASE." );\r
                     return 2;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
@@ -126,7 +126,7 @@ public class ParseParameter {
                     return 1;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
-                    System.out.printf( "%s\n", "What kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM" );\r
+                    System.out.printf( "%s\n", "What kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM." );\r
                     return 2;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
@@ -142,7 +142,8 @@ public class ParseParameter {
                     return 1;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
-                    System.out.printf( "%s\n", "Assign a txt file with the relative path to WORKSPACE, which specify the tools to use for the build and must be located in the path: WORKSPACE/Tools/Conf/" );\r
+                    String workspacePath = System.getenv("WORKSPACE");\r
+                    System.out.printf( "%s\n", "Assign a txt file with relative path to " + workspacePath + ", which specify the tools to use for the build and must be located in the path:" + workspacePath + "\\Tools\\Conf" );\r
                     return 2;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
@@ -152,7 +153,7 @@ public class ParseParameter {
                 }\r
                 String[] S = argstr.split(" ");\r
                 if(S.length > 2){\r
-                    System.out.printf( "%s\n", "The number of TOOL_CHAIN_CONF can not more than 1.");\r
+                    System.out.printf( "%s\n", "There should be one and only one TOOL_CHAIN_CONF. Please check the number of value which follow \"-c\".");\r
                     return 3;\r
                 }\r
                 curcstr = cstr.concat(argstr.substring(2));\r
@@ -163,7 +164,7 @@ public class ParseParameter {
                     return 1;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
-                    System.out.printf( "%s\n", "Specify the TagName, such as GCC, MSFT" );\r
+                    System.out.printf( "%s\n", "Specify the TagName, such as GCC, MSFT." );\r
                     return 2;\r
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
@@ -184,7 +185,7 @@ public class ParseParameter {
                 }\r
                 String[] S = argstr.split(" ");\r
                 if(S.length > 2){\r
-                    System.out.printf( "%s\n", "The format of number is wrong.");\r
+                    System.out.printf( "%s\n", "There should be one and only one integer, which doesn't include space.");\r
                     return 3;\r
                 }\r
                 mstr += argstr.substring(2);\r
@@ -207,60 +208,23 @@ public class ParseParameter {
     public static boolean outputCurSetting(){\r
         \r
         System.out.printf( "%s\n", "The current setting is:" );\r
+        String[] A = { pstr, tstr, astr, cstr, nstr, mstr, mestr };\r
+        String[] B = { curpstr, curtstr, curastr, curcstr, curnstr, curmstr, curmestr };\r
         \r
-        if(curpstr != null){\r
-            System.out.printf( "%s\n", curpstr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", pstr );\r
-        }\r
-        \r
-        if(curtstr != null){\r
-            System.out.printf( "%s\n", curtstr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", tstr );\r
-        }\r
-        \r
-        if(curastr != null){\r
-            System.out.printf( "%s\n", curastr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", astr );\r
-        }\r
-        \r
-        if(curcstr != null){\r
-            System.out.printf( "%s\n", curcstr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", cstr );\r
-        }\r
-        \r
-        if(curnstr != null){\r
-            System.out.printf( "%s\n", curnstr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", nstr );\r
-        }\r
-        \r
-        if(curmstr != null){\r
-            System.out.printf( "%s\n", curmstr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", mstr );\r
-        }\r
-        \r
-        if(curmstr != null){\r
-            System.out.printf( "%s\n", curmestr );\r
-        }\r
-        else{\r
-            System.out.printf( "%s\n", mestr );\r
+        for(int i=0; i<A.length; i++){\r
+            if(B[i] != null){\r
+                System.out.printf( "%s\n", B[i] );\r
+            }\r
+            else{\r
+                System.out.printf( "%s\n", A[i] );\r
+            }\r
+            \r
         }\r
         \r
         return true;\r
     }\r
-     \r
-    public static int length  = 0;\r
+\r
+    \r
     public static String pstr = new String("ACTIVE_PLATFORM                     = ");\r
     public static String tstr = new String("TARGET                              = ");\r
     public static String astr = new String("TARGET_ARCH                         = ");\r
@@ -277,14 +241,6 @@ public class ParseParameter {
     public static String curmstr = null;\r
     public static String curmestr = null;\r
     \r
-    public static int plength = 0;\r
-    public static int tlength = 0;\r
-    public static int alength = 0;\r
-    public static int clength = 0;\r
-    public static int nlength = 0;\r
-    public static int mlength = 0;\r
-    public static int melength = 0;\r
-    \r
     public static boolean npflag = false;\r
     public static boolean ntflag = false;\r
     public static boolean naflag = false;\r