[mdoc] Response file cleanup.
[mono.git] / mcs / tools / mdoc / Mono.Documentation / mdoc.cs
index a67178e20462665c4109f0f2a5dfb5dc039a50a4..c610da8d00da63bd2ee747ca917ef9e25c645213 100644 (file)
@@ -51,21 +51,15 @@ namespace Mono.Documentation {
 
                        bool showVersion = false;
                        bool showHelp    = false;
-                       var extra = new List<string> ();
                        var p = new OptionSet () {
                                { "version",  v => showVersion = v != null },
                                { "v:",       (int? v) => verbosity = v.HasValue ? v.Value : verbosity+1 },
                                { "debug",    v => debug = v != null },
                                { "h|?|help", v => showHelp = v != null },
-                               { "<>",       v => { 
-                                               if (v.Length > 0 && v [0] == '@')
-                                                       extra.AddRange (ReadResponseFile (v.Substring (1)));
-                                               else
-                                                       extra.Add (v);
-                               } },
+                               new ResponseFileSource (),
                        };
 
-                       p.Parse (args);
+                       var extra = p.Parse (args);
 
                        if (showVersion) {
                                Console.WriteLine ("mdoc {0}", Consts.MonoVersion);
@@ -88,52 +82,6 @@ namespace Mono.Documentation {
                        }
                }
 
-               // Cribbed from mcs/driver.cs:LoadArgs(string)
-               static IEnumerable<string> ReadResponseFile (string file)
-               {
-                       StreamReader response;
-                       try {
-                               response = File.OpenText (file);
-                       } catch {
-                               yield break;
-                       }
-
-                       using (response) {
-                               StringBuilder arg = new StringBuilder ();
-
-                               string line;
-                               while ((line = response.ReadLine ()) != null) {
-                                       int t = line.Length;
-
-                                       for (int i = 0; i < t; i++) {
-                                               char c = line [i];
-                                               
-                                               if (c == '"' || c == '\'') {
-                                                       char end = c;
-                                                       
-                                                       for (i++; i < t; i++){
-                                                               c = line [i];
-
-                                                               if (c == end)
-                                                                       break;
-                                                               arg.Append (c);
-                                                       }
-                                               } else if (c == ' ') {
-                                                       if (arg.Length > 0) {
-                                                               yield return arg.ToString ();
-                                                               arg.Length = 0;
-                                                       }
-                                               } else
-                                                       arg.Append (c);
-                                       }
-                                       if (arg.Length > 0) {
-                                               yield return arg.ToString ();
-                                               arg.Length = 0;
-                                       }
-                               }
-                       }
-               }
-
                internal MDocCommand GetCommand (string command)
                {
                        MDocCommand h;