"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/dbus-send.c" between
dbus-1.13.12.tar.xz and dbus-1.13.14.tar.xz

About: D-Bus is an inter-process communication (IPC) system, allowing multiple, concurrently-running applications to communicate with one another. D-Bus supplies both a system daemon and a per-user-login-session daemon. Development version.

dbus-send.c  (dbus-1.13.12.tar.xz):dbus-send.c  (dbus-1.13.14.tar.xz)
skipping to change at line 57 skipping to change at line 57
#include "dbus-print-message.h" #include "dbus-print-message.h"
static const char *appname; static const char *appname;
static void usage (int ecode) _DBUS_GNUC_NORETURN; static void usage (int ecode) _DBUS_GNUC_NORETURN;
static void static void
usage (int ecode) usage (int ecode)
{ {
fprintf (stderr, "Usage: %s [--help] [--system | --session | --bus=ADDRESS | - -peer=ADDRESS] [--dest=NAME] [--type=TYPE] [--print-reply[=literal]] [--reply-ti meout=MSEC] <destination object path> <message name> [contents ...]\n", appname) ; fprintf (stderr, "Usage: %s [--help] [--system | --session | --bus=ADDRESS | - -peer=ADDRESS] [--sender=NAME] [--dest=NAME] [--type=TYPE] [--print-reply[=liter al]] [--reply-timeout=MSEC] <destination object path> <message name> [contents . ..]\n", appname);
exit (ecode); exit (ecode);
} }
/* Abort on any allocation failure; there is nothing else we can do. */ /* Abort on any allocation failure; there is nothing else we can do. */
static void static void
handle_oom (dbus_bool_t success) handle_oom (dbus_bool_t success)
{ {
if (!success) if (!success)
{ {
fprintf (stderr, "%s: Ran out of memory\n", appname); fprintf (stderr, "%s: Ran out of memory\n", appname);
skipping to change at line 264 skipping to change at line 264
int reply_timeout; int reply_timeout;
DBusMessageIter iter; DBusMessageIter iter;
int i; int i;
DBusBusType type = DBUS_BUS_SESSION; DBusBusType type = DBUS_BUS_SESSION;
const char *dest = NULL; const char *dest = NULL;
const char *name = NULL; const char *name = NULL;
const char *path = NULL; const char *path = NULL;
int message_type = DBUS_MESSAGE_TYPE_SIGNAL; int message_type = DBUS_MESSAGE_TYPE_SIGNAL;
const char *type_str = NULL; const char *type_str = NULL;
const char *address = NULL; const char *address = NULL;
const char *sender = NULL;
int is_bus = FALSE; int is_bus = FALSE;
int session_or_system = FALSE; int session_or_system = FALSE;
appname = argv[0]; appname = argv[0];
if (argc < 3) if (argc < 3)
usage (1); usage (1);
print_reply = FALSE; print_reply = FALSE;
print_reply_literal = FALSE; print_reply_literal = FALSE;
skipping to change at line 316 skipping to change at line 317
} }
address = strchr (arg, '=') + 1; address = strchr (arg, '=') + 1;
if (address[0] == '\0') if (address[0] == '\0')
{ {
fprintf (stderr, "\"--peer=\" and \"--bus=\" require an ADDRESS\n" ); fprintf (stderr, "\"--peer=\" and \"--bus=\" require an ADDRESS\n" );
usage (1); usage (1);
} }
} }
else if (strstr (arg, "--sender=") == arg)
{
sender = strchr (arg, '=') + 1;
if (sender[0] == '\0')
{
fprintf (stderr, "\"--sender=\" requires a NAME\n");
usage (1);
}
}
else if (strncmp (arg, "--print-reply", 13) == 0) else if (strncmp (arg, "--print-reply", 13) == 0)
{ {
print_reply = TRUE; print_reply = TRUE;
message_type = DBUS_MESSAGE_TYPE_METHOD_CALL; message_type = DBUS_MESSAGE_TYPE_METHOD_CALL;
if (strcmp (arg + 13, "=literal") == 0) if (strcmp (arg + 13, "=literal") == 0)
print_reply_literal = TRUE; print_reply_literal = TRUE;
else if (*(arg + 13) != '\0') else if (*(arg + 13) != '\0')
{ {
fprintf (stderr, "invalid value (%s) of \"--print-reply\"\n", arg + 13); fprintf (stderr, "invalid value (%s) of \"--print-reply\"\n", arg + 13);
usage (1); usage (1);
skipping to change at line 375 skipping to change at line 386
if (name == NULL) if (name == NULL)
usage (1); usage (1);
if (session_or_system && if (session_or_system &&
(address != NULL)) (address != NULL))
{ {
fprintf (stderr, "\"--peer\" and \"--bus\" may not be used with \"--system \" or \"--session\"\n"); fprintf (stderr, "\"--peer\" and \"--bus\" may not be used with \"--system \" or \"--session\"\n");
usage (1); usage (1);
} }
if (sender != NULL && address != NULL && !is_bus)
{
fprintf (stderr, "\"--peer\" may not be used with \"--sender\"\n");
exit (1);
}
if (type_str != NULL) if (type_str != NULL)
{ {
message_type = dbus_message_type_from_string (type_str); message_type = dbus_message_type_from_string (type_str);
if (!(message_type == DBUS_MESSAGE_TYPE_METHOD_CALL || if (!(message_type == DBUS_MESSAGE_TYPE_METHOD_CALL ||
message_type == DBUS_MESSAGE_TYPE_SIGNAL)) message_type == DBUS_MESSAGE_TYPE_SIGNAL))
{ {
fprintf (stderr, "Message type \"%s\" is not supported\n", fprintf (stderr, "Message type \"%s\" is not supported\n",
type_str); type_str);
exit (1); exit (1);
} }
} }
dbus_error_init (&error); dbus_error_init (&error);
if (dest && !dbus_validate_bus_name (dest, &error)) if (dest && !dbus_validate_bus_name (dest, &error))
{ {
fprintf (stderr, "invalid value (%s) of \"--dest\"\n", dest); fprintf (stderr, "invalid value (%s) of \"--dest\"\n", dest);
dbus_error_free (&error);
usage (1);
}
if (sender && !dbus_validate_bus_name (sender, &error))
{
fprintf (stderr, "invalid value (%s) of \"--sender\"\n", sender);
dbus_error_free (&error);
usage (1); usage (1);
} }
if (address != NULL) if (address != NULL)
{ {
connection = dbus_connection_open (address, &error); connection = dbus_connection_open (address, &error);
} }
else else
{ {
connection = dbus_bus_get (type, &error); connection = dbus_bus_get (type, &error);
skipping to change at line 424 skipping to change at line 449
{ {
if (!dbus_bus_register (connection, &error)) if (!dbus_bus_register (connection, &error))
{ {
fprintf (stderr, "Failed to register on connection to \"%s\" message b us: %s\n", fprintf (stderr, "Failed to register on connection to \"%s\" message b us: %s\n",
address, error.message); address, error.message);
dbus_error_free (&error); dbus_error_free (&error);
exit (1); exit (1);
} }
} }
if (sender != NULL)
{
int ret = dbus_bus_request_name (connection, sender, DBUS_NAME_FLAG_DO_NOT
_QUEUE, &error);
switch (ret)
{
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
/* success */
break;
case DBUS_REQUEST_NAME_REPLY_EXISTS:
fprintf (stderr, "Requested name \"%s\" already has owner\n", sender);
exit (1);
case -1:
fprintf (stderr, "Failed to request sender name \"%s\": %s\n", sender,
error.message);
dbus_error_free (&error);
exit (1);
default:
/* This should be unreachable if the bus is compliant */
fprintf (stderr, "Failed to request sender name \"%s\": unexpected res
ult code %d\n",
sender, ret);
exit (1);
}
}
if (message_type == DBUS_MESSAGE_TYPE_METHOD_CALL) if (message_type == DBUS_MESSAGE_TYPE_METHOD_CALL)
{ {
char *last_dot; char *last_dot;
last_dot = strrchr (name, '.'); last_dot = strrchr (name, '.');
if (last_dot == NULL) if (last_dot == NULL)
{ {
fprintf (stderr, "Must use org.mydomain.Interface.Method notation, no dot in \"%s\"\n", fprintf (stderr, "Must use org.mydomain.Interface.Method notation, no dot in \"%s\"\n",
name); name);
exit (1); exit (1);
 End of changes. 6 change blocks. 
1 lines changed or deleted 52 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)