mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-02 12:10:14 +01:00
* dbus/dbus-sysdeps.c (_dbus_set_fd_nonblocking): move to this file * dbus/dbus-errors.c (dbus_set_error, dbus_set_error_const): allow NULL argument for "message" if the error is a well-known one, fill in a generic message in this case. * dbus/dbus-errors.h (DBusResultCode): Kill DBusResultCode in favor of DBusError * bus/test.c (bus_test_flush_bus): add * bus/policy.c (bus_policy_test): test code stub
44 lines
1,010 B
C
44 lines
1,010 B
C
#include <dbus/dbus.h>
|
|
#include <stdio.h>
|
|
#include "watch.h"
|
|
|
|
int
|
|
main (int argc,
|
|
char **argv)
|
|
{
|
|
DBusConnection *connection;
|
|
DBusError error;
|
|
DBusMessage *message;
|
|
|
|
if (argc < 2)
|
|
{
|
|
fprintf (stderr, "Give the server address as an argument\n");
|
|
return 1;
|
|
}
|
|
|
|
dbus_error_init (&error);
|
|
connection = dbus_connection_open (argv[1], &error);
|
|
if (connection == NULL)
|
|
{
|
|
fprintf (stderr, "Failed to open connection to %s: %s\n",
|
|
argv[1], error.message);
|
|
dbus_error_free (&error);
|
|
return 1;
|
|
}
|
|
|
|
setup_connection (connection);
|
|
|
|
/* Send a message to get things going */
|
|
message = dbus_message_new ("org.freedesktop.DBus.Test", "org.freedesktop.DBus.Test");
|
|
if (!dbus_connection_send (connection,
|
|
message,
|
|
NULL))
|
|
fprintf (stderr, "No memory to send reply\n");
|
|
dbus_message_unref (message);
|
|
|
|
do_mainloop ();
|
|
|
|
dbus_connection_unref (connection);
|
|
|
|
return 0;
|
|
}
|