File pacemaker-ptest-xml-text.diff of Package pacemaker

commit 581af7d3061a3ff680e0a15351099df255cf6b03
Author: Gao,Yan <ygao@suse.com>
Date:   Mon Dec 19 14:39:03 2011 +0800

    Medium: Tools: ptest - Fix "-X, --xml-text" option to handle a XML string as its argument

diff --git a/pengine/ptest.c b/pengine/ptest.c
index 6372a72..545f695 100644
--- a/pengine/ptest.c
+++ b/pengine/ptest.c
@@ -167,6 +167,7 @@ main(int argc, char **argv)
     const char *dot_file = NULL;
     const char *graph_file = NULL;
     const char *input_file = NULL;
+    const char *input_xml = NULL;
 
     /* disable glib's fancy allocators that can't be free'd */
     GMemVTable vtable;
@@ -203,7 +204,8 @@ main(int argc, char **argv)
                 inhibit_exit = TRUE;
                 break;
             case 'X':
-                use_stdin = TRUE;
+                /*use_stdin = TRUE;*/
+                input_xml = optarg;
                 break;
             case 's':
                 show_scores = TRUE;
@@ -290,6 +292,9 @@ main(int argc, char **argv)
     } else if (use_stdin) {
         source = "stdin";
         cib_object = filename2xml(NULL);
+    } else if (input_xml) {
+        source = "input string";
+        cib_object = string2xml(input_xml);
     }
 
     if (cib_object == NULL && source) {
openSUSE Build Service is sponsored by