本文整理汇总了C++中zsys_vprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ zsys_vprintf函数的具体用法?C++ zsys_vprintf怎么用?C++ zsys_vprintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zsys_vprintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zsock_connect
int
zsock_connect (zsock_t *self, const char *format, ...)
{
assert (self);
assert (zsock_is (self));
// Expand format to get full endpoint
va_list argptr;
va_start (argptr, format);
char *endpoint = zsys_vprintf (format, argptr);
va_end (argptr);
int rc = zmq_connect (self->handle, endpoint);
#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4,0,0))
int retries = 4;
while (rc == -1 && zmq_errno () == ECONNREFUSED && retries) {
// This bruteforces a synchronization between connecting and
// binding threads on ZeroMQ v3.2 and earlier, where the bind
// MUST happen before the connect on inproc transports.
zclock_sleep (250);
rc = zmq_connect (self->handle, endpoint);
retries--;
}
#endif
free (endpoint);
return rc;
}
示例2: zcert_save
int
zcert_save (zcert_t *self, char *format, ...)
{
assert (self);
assert (format);
va_list argptr;
va_start (argptr, format);
char *filename = zsys_vprintf (format, argptr);
va_end (argptr);
// Save public certificate using specified filename
zcert_save_public (self, filename);
// Now save secret certificate using filename with "_secret" suffix
s_save_metadata_all (self);
zconfig_comment (self->config, " ZeroMQ CURVE **Secret** Certificate");
zconfig_comment (self->config, " DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions.");
zconfig_put (self->config, "/curve/public-key", self->public_txt);
zconfig_put (self->config, "/curve/secret-key", self->secret_txt);
char filename_secret [256];
snprintf (filename_secret, 256, "%s_secret", filename);
zsys_file_mode_private ();
int rc = zconfig_save (self->config, filename_secret);
zsys_file_mode_default ();
zstr_free (&filename);
return rc;
}
示例3: zsys_dir_create
int
zsys_dir_create (const char *pathname, ...)
{
va_list argptr;
va_start (argptr, pathname);
char *formatted = zsys_vprintf (pathname, argptr);
va_end (argptr);
// Create parent directory levels if needed
char *slash = strchr (formatted + 1, '/');
while (true) {
if (slash)
*slash = 0; // Cut at slash
mode_t mode = zsys_file_mode (formatted);
if (mode == (mode_t)-1) {
// Does not exist, try to create it
#if (defined (__WINDOWS__))
if (!CreateDirectoryA (formatted, NULL))
#else
if (mkdir (formatted, 0775))
#endif
return -1; // Failed
}
else
if ((mode & S_IFDIR) == 0) {
// Not a directory, abort
}
if (!slash) // End if last segment
break;
*slash = '/';
slash = strchr (slash + 1, '/');
}
free (formatted);
return 0;
}
示例4: s_vprintf
static char *
s_vprintf (const char *format, ...)
{
va_list argptr;
va_start (argptr, format);
char *string = zsys_vprintf (format, argptr);
va_end (argptr);
return (string);
}
示例5: zsys_debug
void
zsys_debug (const char *format, ...)
{
va_list argptr;
va_start (argptr, format);
char *string = zsys_vprintf (format, argptr);
va_end (argptr);
s_log ('D', string);
free (string);
}
示例6: zcert_set_meta
void
zcert_set_meta (zcert_t *self, const char *name, const char *format, ...)
{
va_list argptr;
va_start (argptr, format);
char *value = zsys_vprintf (format, argptr);
va_end (argptr);
zhash_insert (self->metadata, name, value);
zstr_free (&value);
}
示例7: zre_log_msg_set_data
void
zre_log_msg_set_data (zre_log_msg_t *self, char *format, ...)
{
// Format data from provided arguments
assert (self);
va_list argptr;
va_start (argptr, format);
free (self->data);
self->data = zsys_vprintf (format, argptr);
va_end (argptr);
}
示例8: zre_msg_set_ipaddress
void
zre_msg_set_ipaddress (zre_msg_t *self, const char *format, ...)
{
// Format ipaddress from provided arguments
assert (self);
va_list argptr;
va_start (argptr, format);
free (self->ipaddress);
self->ipaddress = zsys_vprintf (format, argptr);
va_end (argptr);
}
示例9: zre_msg_set_group
void
zre_msg_set_group (zre_msg_t *self, const char *format, ...)
{
// Format group from provided arguments
assert (self);
va_list argptr;
va_start (argptr, format);
free (self->group);
self->group = zsys_vprintf (format, argptr);
va_end (argptr);
}
示例10: zconfig_putf
void
zconfig_putf (zconfig_t *self, const char *path, const char *format, ...)
{
assert (self);
va_list argptr;
va_start (argptr, format);
char *value = zsys_vprintf (format, argptr);
va_end (argptr);
zconfig_put (self, path, value);
zstr_free (&value);
}
示例11: zgossip_msg_set_value
void
zgossip_msg_set_value (zgossip_msg_t *self, const char *format, ...)
{
// Format value from provided arguments
assert (self);
va_list argptr;
va_start (argptr, format);
free (self->value);
self->value = zsys_vprintf (format, argptr);
va_end (argptr);
}
示例12: zauth_configure_plain
void
zauth_configure_plain (zauth_t *self, char *domain, char *filename, ...)
{
assert (self);
assert (domain);
va_list argptr;
va_start (argptr, filename);
char *formatted = zsys_vprintf (filename, argptr);
va_end (argptr);
zstr_sendx (self->pipe, "PLAIN", domain, formatted, NULL);
free (formatted);
}
示例13: zyre_gossip_connect
void
zyre_gossip_connect (zyre_t *self, const char *format, ...)
{
assert (self);
va_list argptr;
va_start (argptr, format);
char *string = zsys_vprintf (format, argptr);
va_end (argptr);
zstr_sendx (self->actor, "GOSSIP CONNECT", string, NULL);
free (string);
}
示例14: zyre_set_announce
void
zyre_set_announce (zyre_t *self, const char *format, ...)
{
assert (self);
va_list argptr;
va_start (argptr, format);
char *string = zsys_vprintf (format, argptr);
va_end (argptr);
zstr_sendx (self->actor, "SET ANNOUNCE", string, NULL);
free (string);
}
示例15: zyre_set_header
void
zyre_set_header (zyre_t *self, const char *name, const char *format, ...)
{
assert (self);
va_list argptr;
va_start (argptr, format);
char *string = zsys_vprintf (format, argptr);
va_end (argptr);
zstr_sendx (self->actor, "SET HEADER", name, string, NULL);
free (string);
}