hook gvariant vectors up to kdbus
[platform/upstream/glib.git] / gobject / gobject-query.c
index 39b645f..e93943f 100644 (file)
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include       "../config.h"
 
-#include        <glib-object.h>
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <glib-object.h>
+#include <glib/gprintf.h>
 
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <string.h>
-#ifdef HAVE_UNISTD_H
-#include       <unistd.h>
-#endif
-#include       <sys/stat.h>
-#include       <fcntl.h>
 
 static gchar *indent_inc = NULL;
 static guint spacing = 1;
@@ -66,9 +63,9 @@ show_nodes (GType        type,
   
   if (type != root)
     for (i = 0; i < spacing; i++)
-      fprintf (f_out, "%s%s\n", indent, O_VLINE);
+      g_fprintf (f_out, "%s%s\n", indent, O_VLINE);
   
-  fprintf (f_out, "%s%s%s%s",
+  g_fprintf (f_out, "%s%s%s%s",
           indent,
           sibling ? O_BRANCH : (type != root ? O_LLEAF : O_SPACE),
           O_ESPACE,
@@ -101,16 +98,16 @@ show_nodes (GType        type,
 static gint
 help (gchar *arg)
 {
-  fprintf (stderr, "usage: query <qualifier> [-r <type>] [-{i|b} \"\"] [-s #] [-{h|x|y}]\n");
-  fprintf (stderr, "       -r       specifiy root type\n");
-  fprintf (stderr, "       -n       don't descend type tree\n");
-  fprintf (stderr, "       -h       guess what ;)\n");
-  fprintf (stderr, "       -b       specify indent string\n");
-  fprintf (stderr, "       -i       specify incremental indent string\n");
-  fprintf (stderr, "       -s       specify line spacing\n");
-  fprintf (stderr, "qualifiers:\n");
-  fprintf (stderr, "       froots   iterate over fundamental roots\n");
-  fprintf (stderr, "       tree     print BSE type tree\n");
+  g_fprintf (stderr, "usage: gobject-query <qualifier> [-r <type>] [-{i|b} \"\"] [-s #] [-{h|x|y}]\n");
+  g_fprintf (stderr, "       -r       specifiy root type\n");
+  g_fprintf (stderr, "       -n       don't descend type tree\n");
+  g_fprintf (stderr, "       -h       guess what ;)\n");
+  g_fprintf (stderr, "       -b       specify indent string\n");
+  g_fprintf (stderr, "       -i       specify incremental indent string\n");
+  g_fprintf (stderr, "       -s       specify line spacing\n");
+  g_fprintf (stderr, "qualifiers:\n");
+  g_fprintf (stderr, "       froots   iterate over fundamental roots\n");
+  g_fprintf (stderr, "       tree     print type tree\n");
   
   return arg != NULL;
 }
@@ -122,7 +119,7 @@ main (gint   argc,
   GLogLevelFlags fatal_mask;
   gboolean gen_froots = 0;
   gboolean gen_tree = 0;
-  guint i;
+  gint i;
   gchar *iindent = "";
 
   f_out = stdout;
@@ -133,8 +130,6 @@ main (gint   argc,
   
   root = G_TYPE_OBJECT;
 
-  g_type_init (0);
-  
   for (i = 1; i < argc; i++)
     {
       if (strcmp ("-s", argv[i]) == 0)
@@ -208,8 +203,6 @@ main (gint   argc,
       indent_inc = g_new (gchar, strlen (O_SPACE) + 1);
       *indent_inc = 0;
       strcpy (indent_inc, O_SPACE);
-      strcpy (indent_inc, O_SPACE);
-      strcpy (indent_inc, O_SPACE);
     }
   
   if (gen_tree)
@@ -217,7 +210,7 @@ main (gint   argc,
   if (gen_froots)
     {
       root = ~0;
-      for (i = 0; i < 256; i++)
+      for (i = 0; i <= G_TYPE_FUNDAMENTAL_MAX; i += G_TYPE_MAKE_FUNDAMENTAL (1))
        {
          const gchar *name = g_type_name (i);