aboutsummaryrefslogtreecommitdiffstats
path: root/xenstore.c
diff options
context:
space:
mode:
Diffstat (limited to 'xenstore.c')
-rw-r--r--xenstore.c68
1 files changed, 18 insertions, 50 deletions
diff --git a/xenstore.c b/xenstore.c
index f43b9d2..3aaa229 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -1,60 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <signal.h>
-#include <xs.h>
+#include <gtk/gtk.h>
-#include "xenstore.h"
+#include "xenviews.h"
-/* ------------------------------------------------------------- */
+/* ------------------------------------------------------------------ */
-struct xs_handle *xenstore_open(int daemon, int domain,
- int readonly_ok, int verbose)
+int
+main(int argc, char *argv[])
{
- struct xs_handle *xenstore = NULL;
+ setlocale(LC_ALL,"");
+ gtk_init(&argc, &argv);
- if (NULL == xenstore && daemon && readonly_ok) {
- xenstore = xs_daemon_open_readonly();
- if (NULL == xenstore)
- fprintf(stderr,"can't connect to %s\n",xs_daemon_socket_ro());
- else
- if (verbose)
- printf("connected to %s\n", xs_daemon_socket_ro());
- }
+ xenstore_create_window();
+ gtk_widget_show_all(xs_toplevel);
- if (NULL == xenstore && daemon) {
- xenstore = xs_daemon_open();
- if (NULL == xenstore)
- fprintf(stderr,"can't connect to %s\n",xs_daemon_socket());
- else
- if (verbose)
- printf("connected to %s\n", xs_daemon_socket());
- }
-
- if (NULL == xenstore && domain) {
- xenstore = xs_domain_open();
- if (NULL == xenstore)
- fprintf(stderr, "can't connect to %s\n", xs_domain_dev());
- else
- if (verbose)
- printf("connected to %s\n", xs_domain_dev());
- }
- return xenstore;
-}
-
-int xenstore_read(struct xs_handle *xenstore, char *path, char *dst, size_t size)
-{
- xs_transaction_t xst;
- char *xs_value = NULL;
-
- xst = xs_transaction_start(xenstore);
- if (!xst)
- return -1;
-
- xs_value = xs_read(xenstore, xst, path, NULL);
- xs_transaction_end(xenstore, xst, 0);
- if (NULL == xs_value)
- return -2;
- snprintf(dst, size, "%s", xs_value);
- free(xs_value);
- return 0;
+ gtk_main();
+ fprintf(stderr,"bye...\n");
+ exit(0);
}