您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ str_printfa函数代码示例

51自学网 2021-06-03 08:26:34
  C++
这篇教程C++ str_printfa函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中str_printfa函数的典型用法代码示例。如果您正苦于以下问题:C++ str_printfa函数的具体用法?C++ str_printfa怎么用?C++ str_printfa使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了str_printfa函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: director_request_get_timeout_error

static const char *director_request_get_timeout_error(struct director_request *request,				   struct user *user, string_t *str){	unsigned int secs;	str_truncate(str, 0);	str_printfa(str, "Timeout because %s - queued for %u secs (",		    delay_reason_strings[request->delay_reason],		    (unsigned int)(ioloop_time - request->create_time));	if (request->dir->ring_last_sync_time == 0)		str_append(str, "Ring has never been synced");	else {		secs = ioloop_time - request->dir->ring_last_sync_time;		if (request->dir->ring_synced)			str_printfa(str, "Ring synced for %u secs", secs);		else			str_printfa(str, "Ring not synced for %u secs", secs);	}	if (user != NULL) {		if (user->weak)			str_append(str, ", weak user");		str_printfa(str, ", user refreshed %u secs ago",			    (unsigned int)(ioloop_time - user->timestamp));	}	str_printfa(str, "hash=%u)", request->username_hash);	return str_c(str);}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:30,


示例2: solr_lookup_add_doc

static void solr_lookup_add_doc(struct solr_lookup_xml_context *ctx){	struct fts_score_map *score;	struct solr_result *result;	const char *box_id;	if (ctx->uid == 0) {		i_error("fts_solr: Query didn't return uid");		return;	}	if (ctx->mailbox == NULL) {		/* looking up from a single mailbox only */		box_id = "";	} else if (ctx->uidvalidity != 0) {		/* old style lookup */		string_t *str = t_str_new(64);		str_printfa(str, "%u/001", ctx->uidvalidity);		str_append(str, ctx->mailbox);		if (ctx->ns != NULL)			str_printfa(str, "/001%s", ctx->ns);		box_id = str_c(str);	} else {		/* new style lookup */		box_id = ctx->mailbox;	}	result = solr_result_get(ctx, box_id);	seq_range_array_add(&result->uids, ctx->uid);	if (ctx->score != 0) {		score = array_append_space(&result->scores);		score->uid = ctx->uid;		score->score = ctx->score;	}}
开发者ID:Distrotech,项目名称:dovecot,代码行数:35,


示例3: service_process_get_status_error

static voidservice_process_get_status_error(string_t *str, struct service_process *process,				 int status, bool *default_fatal_r){	struct service *service = process->service;	const char *msg;	*default_fatal_r = FALSE;	str_printfa(str, "service(%s): child %s ", service->set->name,		    dec2str(process->pid));	if (WIFSIGNALED(status)) {		str_printfa(str, "killed with signal %d", WTERMSIG(status));		log_coredump(service, str, status);		return;	}	if (!WIFEXITED(status)) {		str_printfa(str, "died with status %d", status);		return;	}	status = WEXITSTATUS(status);	if (status == 0) {		str_truncate(str, 0);		return;	}	str_printfa(str, "returned error %d", status);	msg = get_exit_status_message(service, status);	if (msg != NULL)		str_printfa(str, " (%s)", msg);	if (status == FATAL_DEFAULT)		*default_fatal_r = TRUE;}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:35,


示例4: lmtp_client_send_xclient

static bool lmtp_client_send_xclient(struct lmtp_client *client){	string_t *str;	unsigned int empty_len;	if (client->xclient_args == NULL) {		/* not supported */		return FALSE;	}	if (client->xclient_sent)		return FALSE;	str = t_str_new(64);	str_append(str, "XCLIENT");	empty_len = str_len(str);	if (client->set.source_ip.family != 0 &&	    str_array_icase_find(client->xclient_args, "ADDR"))		str_printfa(str, " ADDR=%s", net_ip2addr(&client->set.source_ip));	if (client->set.source_port != 0 &&	    str_array_icase_find(client->xclient_args, "PORT"))		str_printfa(str, " PORT=%u", client->set.source_port);	if (client->set.proxy_ttl != 0 &&	    str_array_icase_find(client->xclient_args, "TTL"))		str_printfa(str, " TTL=%u", client->set.proxy_ttl);	if (client->set.proxy_timeout_secs != 0 &&	    str_array_icase_find(client->xclient_args, "TIMEOUT"))		str_printfa(str, " TIMEOUT=%u", client->set.proxy_timeout_secs);	if (str_len(str) == empty_len)		return FALSE;	str_append(str, "/r/n");	o_stream_nsend(client->output, str_data(str), str_len(str));	return TRUE;}
开发者ID:jkerihuel,项目名称:dovecot,代码行数:35,


示例5: verify_plain_callback

static void verify_plain_callback(enum passdb_result result,				  struct auth_request *request){	struct auth_worker_client *client = request->context;	string_t *str;	if (request->failed && result == PASSDB_RESULT_OK)		result = PASSDB_RESULT_PASSWORD_MISMATCH;	str = t_str_new(128);	str_printfa(str, "%u/t", request->id);	if (result == PASSDB_RESULT_OK)		str_append(str, "OK");	else		str_printfa(str, "FAIL/t%d", result);	if (result != PASSDB_RESULT_INTERNAL_FAILURE) {		str_append_c(str, '/t');		str_append_tabescaped(str, request->user);		str_append_c(str, '/t');		if (request->passdb_password != NULL)			str_append_tabescaped(str, request->passdb_password);		reply_append_extra_fields(str, request);	}	str_append_c(str, '/n');	auth_worker_send_reply(client, request, str);	auth_request_unref(&request);	auth_worker_client_check_throttle(client);	auth_worker_client_unref(&client);}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:31,


示例6: mailbox_uidvalidity_rename

static intmailbox_uidvalidity_rename(const char *path, uint32_t *uid_validity,			   bool log_enoent){	string_t *src, *dest;	unsigned int i, prefix_len;	int ret;	src = t_str_new(256);	str_append(src, path);	dest = t_str_new(256);	str_append(dest, path);	prefix_len = str_len(src);	for (i = 0; i < RETRY_COUNT; i++) {		str_truncate(src, prefix_len);		str_truncate(dest, prefix_len);		str_printfa(src, ".%08x", *uid_validity);		*uid_validity += 1;		if (*uid_validity == 0)			*uid_validity += 1;		str_printfa(dest, ".%08x", *uid_validity);		if ((ret = rename(str_c(src), str_c(dest))) == 0 ||		    errno != ENOENT)			break;		/* possibly a race condition. try the next value. */	}	if (ret < 0 && (errno != ENOENT || log_enoent))		i_error("rename(%s, %s) failed: %m", str_c(src), str_c(dest));	return ret;}
开发者ID:manuelm,项目名称:dovecot,代码行数:34,


示例7: module_check_wrong_binary_dependency

static boolmodule_check_wrong_binary_dependency(const struct module_dir_load_settings *set,				     struct module *module, const char **error_r){	const char *symbol_name, *binary_dep, *const *names;	string_t *errstr;	if (set->binary_name == NULL)		return TRUE;	symbol_name = t_strconcat(module->name, "_binary_dependency", NULL);	binary_dep = dlsym(module->handle, symbol_name);	if (binary_dep == NULL)		return TRUE;	names = t_strsplit(binary_dep, " ");	if (str_array_find(names, set->binary_name))		return TRUE;	errstr = t_str_new(128);	str_printfa(errstr, "Can't load plugin %s: "		    "Plugin is intended to be used only by ", module->name);	if (names[1] == NULL)		str_printfa(errstr, "%s binary", binary_dep);	else		str_printfa(errstr, "binaries: %s", binary_dep);	str_printfa(errstr, " (we're %s)", set->binary_name);	*error_r = str_c(errstr);	return FALSE;}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:30,


示例8: lookup_credentials_callback

static voidlookup_credentials_callback(enum passdb_result result,			    const unsigned char *credentials, size_t size,			    struct auth_request *request){	struct auth_worker_client *client = request->context;	string_t *str;	if (request->failed && result == PASSDB_RESULT_OK)		result = PASSDB_RESULT_PASSWORD_MISMATCH;	str = t_str_new(128);	str_printfa(str, "%u/t", request->id);	if (result != PASSDB_RESULT_OK)		str_printfa(str, "FAIL/t%d", result);	else {		str_append(str, "OK/t");		str_append_tabescaped(str, request->user);		str_append_c(str, '/t');		if (request->credentials_scheme[0] != '/0') {			str_printfa(str, "{%s.b64}", request->credentials_scheme);			base64_encode(credentials, size, str);		} else {			i_assert(size == 0);		}		reply_append_extra_fields(str, request);	}	str_append_c(str, '/n');	auth_worker_send_reply(client, request, str);	auth_request_unref(&request);	auth_worker_client_check_throttle(client);	auth_worker_client_unref(&client);}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:35,


示例9: proxy_log_connect_error

static voidproxy_log_connect_error(struct login_proxy *proxy){	string_t *str = t_str_new(128);	struct ip_addr local_ip;	unsigned int local_port;	str_printfa(str, "proxy(%s): ", proxy->client->virtual_user);	if (!proxy->connected) {		str_printfa(str, "connect(%s, %u) failed: %m",			    proxy->host, proxy->port);	} else {		str_printfa(str, "Login for %s:%u timed out in state=%u",			    proxy->host, proxy->port,			    proxy->client->proxy_state);	}	str_printfa(str, " (after %u secs",		    (unsigned int)(ioloop_time - proxy->created.tv_sec));	if (proxy->server_fd != -1 &&	    net_getsockname(proxy->server_fd, &local_ip, &local_port) == 0) {		str_printfa(str, ", local=%s:%u",			    net_ip2addr(&local_ip), local_port);	}	str_append_c(str, ')');	i_error("%s", str_c(str));}
开发者ID:Distrotech,项目名称:dovecot,代码行数:28,


示例10: client_proxy_finish_destroy_client

void client_proxy_finish_destroy_client(struct client *client){	string_t *str = t_str_new(128);	if (client->input->closed) {		/* input stream got closed in client_send_raw_data().		   In most places we don't have to check for this explicitly,		   but login_proxy_detach() attempts to get and use the		   istream's fd, which is now -1. */		client_destroy(client, "Disconnected");		return;	}	str_printfa(str, "proxy(%s): started proxying to %s:%u",		    client->virtual_user,		    login_proxy_get_host(client->login_proxy),		    login_proxy_get_port(client->login_proxy));	if (strcmp(client->virtual_user, client->proxy_user) != 0) {		/* remote username is different, log it */		str_append_c(str, '/');		str_append(str, client->proxy_user);	}	if (client->proxy_master_user != NULL)		str_printfa(str, " (master %s)", client->proxy_master_user);	login_proxy_detach(client->login_proxy);	client_destroy_success(client, str_c(str));}
开发者ID:oposs,项目名称:dovecot-extensions,代码行数:28,


示例11: fts_icu_transliterator_create

int fts_icu_transliterator_create(const char *id,                                  UTransliterator **transliterator_r,                                  const char **error_r){    UErrorCode err = U_ZERO_ERROR;    UParseError perr;    buffer_t *id_utf16_buf = buffer_create_dynamic(pool_datastack_create(), 2 * strlen(id));    UChar *id_utf16;    memset(&perr, 0, sizeof(perr));    fts_icu_utf8_to_utf16(id_utf16_buf, id);    id_utf16 = (UChar *)str_c(id_utf16_buf);    *transliterator_r = utrans_openU(id_utf16,                                     id_utf16_buf->used / sizeof(UChar),                                     UTRANS_FORWARD, NULL, 0, &perr, &err);    if (U_FAILURE(err)) {        string_t *str = t_str_new(128);        str_printfa(str, "Failed to open transliterator for id '%s': %s",                    id, u_errorName(err));        if (perr.line >= 1) {            /* we have only one line in our ID */            str_printfa(str, " (parse error on offset %u)",                        perr.offset);        }        *error_r = str_c(str);        return -1;    }    return 0;}
开发者ID:jfsmig,项目名称:dovecot-core,代码行数:30,


示例12: login_proxy_free_errstr

static void login_proxy_free_errstr(struct login_proxy **_proxy,				    const char *errstr, bool server){	struct login_proxy *proxy = *_proxy;	string_t *reason = t_str_new(128);	str_printfa(reason, "Disconnected by %s", server ? "server" : "client");	if (errstr[0] != '/0')		str_printfa(reason, ": %s", errstr);	str_printfa(reason, "(%ds idle, in=%"PRIuUOFF_T", out=%"PRIuUOFF_T,		    (int)(ioloop_time - proxy->last_io),		    proxy->server_output->offset, proxy->client_output->offset);	if (o_stream_get_buffer_used_size(proxy->client_output) > 0) {		str_printfa(reason, "+%"PRIuSIZE_T,			    o_stream_get_buffer_used_size(proxy->client_output));	}	if (proxy->server_io == NULL)		str_append(reason, ", client output blocked");	if (proxy->client_io == NULL)		str_append(reason, ", server output blocked");	str_append_c(reason, ')');	if (server)		login_proxy_free_delayed(_proxy, str_c(reason));	else		login_proxy_free_reason(_proxy, str_c(reason));}
开发者ID:bjacke,项目名称:core,代码行数:27,


示例13: t_str_new

static const char *client_get_commands_status(struct client *client){	struct client_command_context *cmd;	unsigned int msecs_in_ioloop;	uint64_t running_usecs = 0, ioloop_wait_usecs;	unsigned long long bytes_in = 0, bytes_out = 0;	string_t *str;	if (client->command_queue == NULL)		return "";	str = t_str_new(128);	str_append(str, " (");	for (cmd = client->command_queue; cmd != NULL; cmd = cmd->next) {		str_append(str, cmd->name);		if (cmd->next != NULL)			str_append_c(str, ',');		running_usecs += cmd->running_usecs;		bytes_in += cmd->bytes_in;		bytes_out += cmd->bytes_out;	}	ioloop_wait_usecs = io_loop_get_wait_usecs(current_ioloop);	msecs_in_ioloop = (ioloop_wait_usecs -		client->command_queue->start_ioloop_wait_usecs + 999) / 1000;	str_printfa(str, " running for %d.%03d + waiting for %d.%03d secs",		    (int)((running_usecs+999)/1000 / 1000),		    (int)((running_usecs+999)/1000 % 1000),		    msecs_in_ioloop / 1000, msecs_in_ioloop % 1000);	str_printfa(str, ", %llu B in + %llu+%"PRIuSIZE_T" B out)",		    bytes_in, bytes_out,		    o_stream_get_buffer_used_size(client->output));	return str_c(str);}
开发者ID:Dexus,项目名称:ubuntu-trusty-dovecot,代码行数:34,


示例14: client_send_login_reply

static voidclient_send_login_reply(struct imap_client *client, string_t *str,			const char *line){	const char *capability;	bool tagged_capability;	capability = client->proxy_backend_capability;	tagged_capability = strncasecmp(line, "[CAPABILITY ", 12) == 0;	if (tagged_capability)		capability = t_strcut(line + 12, ']');	if (client->client_ignores_capability_resp_code && capability != NULL) {		/* client has used CAPABILITY command, so it didn't understand		   the capabilities in the banner. send the backend's untagged		   CAPABILITY reply and hope that the client understands it */		str_printfa(str, "* CAPABILITY %s/r/n", capability);	}	str_append(str, client->cmd_tag);	str_append(str, " OK ");	if (!client->client_ignores_capability_resp_code &&	    !tagged_capability && capability != NULL) {		str_printfa(str, "[CAPABILITY %s] ", capability);		if (*line == '[') {			/* we need to send the capability.			   skip over this resp-code */			while (*line != ']' && *line != '/0')				line++;			if (*line == ' ') line++;		}	}	str_append(str, line);	str_append(str, "/r/n");}
开发者ID:manuelm,项目名称:dovecot,代码行数:34,


示例15: imapc_sync_index_flags

static void imapc_sync_index_flags(struct imapc_sync_context *ctx,				   const struct mail_index_sync_rec *sync_rec){	string_t *str = t_str_new(128);	i_assert(sync_rec->type == MAIL_INDEX_SYNC_TYPE_FLAGS);	if (sync_rec->add_flags != 0) {		i_assert((sync_rec->add_flags & MAIL_RECENT) == 0);		str_printfa(str, "UID STORE %u:%u +FLAGS (",			    sync_rec->uid1, sync_rec->uid2);		imap_write_flags(str, sync_rec->add_flags, NULL);		str_append_c(str, ')');		imapc_sync_cmd(ctx, str_c(str));	}	if (sync_rec->remove_flags != 0) {		i_assert((sync_rec->remove_flags & MAIL_RECENT) == 0);		str_truncate(str, 0);		str_printfa(str, "UID STORE %u:%u -FLAGS (",			    sync_rec->uid1, sync_rec->uid2);		imap_write_flags(str, sync_rec->remove_flags, NULL);		str_append_c(str, ')');		imapc_sync_cmd(ctx, str_c(str));	}}
开发者ID:Distrotech,项目名称:dovecot,代码行数:26,


示例16: mkdir_chown_full

static intmkdir_chown_full(const char *path, mode_t mode, uid_t uid,		 gid_t gid, const char *gid_origin){	string_t *str;	mode_t old_mask;	int ret, orig_errno;	old_mask = umask(0);	ret = mkdir(path, mode);	umask(old_mask);	if (ret < 0) {		if (errno == EISDIR || errno == ENOSYS) {			/* EISDIR check is for BSD/OS which returns it if path			   contains '/' at the end and it exists.			   ENOSYS check is for NFS mount points. */			errno = EEXIST;		}		return -1;	}	if (chown(path, uid, gid) < 0) {		orig_errno = errno;		if (rmdir(path) < 0)			i_error("rmdir(%s) failed: %m", path);		errno = orig_errno;		if (errno == EPERM && uid == (uid_t)-1) {			i_error("%s", eperm_error_get_chgrp("chown", path, gid,							    gid_origin));			return -1;		}		str = t_str_new(256);		str_printfa(str, "chown(%s, %ld", path,			    uid == (uid_t)-1 ? -1L : (long)uid);		if (uid != (uid_t)-1) {			struct passwd pw;			if (i_getpwuid(uid, &pw) > 0)				str_printfa(str, "(%s)", pw.pw_name);		}		str_printfa(str, ", %ld",			    gid == (gid_t)-1 ? -1L : (long)gid);		if (gid != (gid_t)-1) {			struct group gr;			if (i_getgrgid(uid, &gr) > 0)				str_printfa(str, "(%s)", gr.gr_name);		}		errno = orig_errno;		i_error("%s) failed: %m", str_c(str));		return -1;	}	return 0;}
开发者ID:aosm,项目名称:dovecot,代码行数:58,


示例17: random_fill

static string_t *get_digest_challenge(struct digest_auth_request *request){	const struct auth_settings *set = request->auth_request.set;	buffer_t buf;	string_t *str;	const char *const *tmp;	unsigned char nonce[16];	unsigned char nonce_base64[MAX_BASE64_ENCODED_SIZE(sizeof(nonce))+1];	int i;	bool first_qop;	/*	   realm="hostname" (multiple allowed)	   nonce="randomized data, at least 64bit"	   qop="auth,auth-int,auth-conf"	   maxbuf=number (with auth-int, auth-conf, defaults to 64k)	   charset="utf-8" (iso-8859-1 if it doesn't exist)	   algorithm="md5-sess"	   cipher="3des,des,rc4-40,rc4,rc4-56" (with auth-conf)	*/	/* get 128bit of random data as nonce */	random_fill(nonce, sizeof(nonce));	buffer_create_from_data(&buf, nonce_base64, sizeof(nonce_base64));	base64_encode(nonce, sizeof(nonce), &buf);	buffer_append_c(&buf, '/0');	request->nonce = p_strdup(request->pool, buf.data);	str = t_str_new(256);	if (*set->realms_arr == NULL) {		/* If no realms are given, at least Cyrus SASL client defaults		   to destination host name */		str_append(str, "realm=/"/",");	} else {		for (tmp = set->realms_arr; *tmp != NULL; tmp++)			str_printfa(str, "realm=/"%s/",", *tmp);	}	str_printfa(str, "nonce=/"%s/",", request->nonce);	str_append(str, "qop=/""); first_qop = TRUE;	for (i = 0; i < QOP_COUNT; i++) {		if (request->qop & (1 << i)) {			if (first_qop)				first_qop = FALSE;			else				str_append_c(str, ',');			str_append(str, qop_names[i]);		}	}	str_append(str, "/",");	str_append(str, "charset=/"utf-8/","		   "algorithm=/"md5-sess/"");	return str;}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:57,


示例18: t_str_new

static const char *get_body_name(const struct imap_fetch_body_data *body){	string_t *str;	str = t_str_new(128);	str_printfa(str, "BODY[%s]", body->section);	if (body->skip_set)		str_printfa(str, "<%"PRIuUOFF_T">", body->skip);	return str_c(str);}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:10,


示例19: client_export_iter_session

static int client_export_iter_session(struct client *client){	struct client_export_cmd *cmd = client->cmd_export;	struct mail_session *session = client->mail_session_iter;	i_assert(cmd->level == MAIL_EXPORT_LEVEL_SESSION);	mail_session_unref(&client->mail_session_iter);	if (!cmd->header_sent) {		o_stream_nsend_str(client->output,			"session/tuser/tip/tservice/tpid/tconnected"			"/tlast_update/tnum_cmds"			MAIL_STATS_HEADER);		cmd->header_sent = TRUE;	}	for (; session != NULL; session = session->stable_next) {		if (client_is_busy(client))			break;		if (!mail_export_filter_match_session(&cmd->filter, session))			continue;		str_truncate(cmd->str, 0);		T_BEGIN {			str_append(cmd->str, guid_128_to_string(session->guid));			str_append_c(cmd->str, '/t');			str_append_tabescaped(cmd->str, session->user->name);			str_append_c(cmd->str, '/t');			if (session->ip != NULL) {				str_append(cmd->str,					   net_ip2addr(&session->ip->ip));			}			str_append_c(cmd->str, '/t');			str_append_tabescaped(cmd->str, session->service);		} T_END;		str_printfa(cmd->str, "/t%ld", (long)session->pid);		str_printfa(cmd->str, "/t%d", !session->disconnected);		client_export_timeval(cmd->str, &session->last_update);		str_printfa(cmd->str, "/t%u", session->num_cmds);		client_export_mail_stats(cmd->str, &session->stats);		str_append_c(cmd->str, '/n');		o_stream_nsend(client->output, str_data(cmd->str),			       str_len(cmd->str));	}	if (session != NULL) {		client->mail_session_iter = session;		mail_session_ref(session);		return 0;	}	return 1;}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:52,


示例20: mail_log_append_uid

static voidmail_log_append_uid(struct mail_log_mail_txn_context *ctx,		    struct mail_log_message *msg, string_t *str, uint32_t uid){	if (uid != 0)		str_printfa(str, "uid=%u", uid);	else {		/* we don't know the uid yet, assign it later */		str_printfa(str, "uid=");		msg->pretext = p_strdup(ctx->pool, str_c(str));		str_truncate(str, 0);	}}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:13,


示例21: log_coredump

static voidlog_coredump(struct service *service, string_t *str, int status){#ifdef WCOREDUMP	int signum = WTERMSIG(status);	if (WCOREDUMP(status) != 0) {		str_append(str, " (core dumped)");		return;	}	if (signum != SIGABRT && signum != SIGSEGV && signum != SIGBUS)		return;	/* let's try to figure out why we didn't get a core dump */	if (core_dumps_disabled) {		str_printfa(str, " (core dumps disabled)");		return;	}#ifndef HAVE_PR_SET_DUMPABLE	if (!service->set->drop_priv_before_exec && service->uid != 0) {		str_printfa(str, " (core not dumped - set service %s "			    "{ drop_priv_before_exec=yes })",			    service->set->name);		return;	}	if (*service->set->privileged_group != '/0' && service->uid != 0) {		str_printfa(str, " (core not dumped - service %s "			    "{ privileged_group } prevented it)",			    service->set->name);		return;	}#else	if (!service->set->login_dump_core &&	    service->type == SERVICE_TYPE_LOGIN) {		str_printfa(str, " (core not dumped - add -D parameter to "			    "service %s { executable }", service->set->name);		return;	}#endif	if (service->set->chroot[0] != '/0') {		str_printfa(str, " (core not dumped - try to clear "			    "service %s { chroot = } )", service->set->name);		return;	}	str_append(str, " (core not dumped)");#endif}
开发者ID:manuelm,项目名称:dovecot,代码行数:50,


示例22: client_input_status_overview

static int client_input_status_overview(struct doveadm_connection *client){	struct replicator_queue *queue =		replicator_brain_get_queue(client->brain);	struct replicator_queue_iter *iter;	struct replicator_user *user;	enum replication_priority priority;	unsigned int pending_counts[REPLICATION_PRIORITY_SYNC+1];	unsigned int user_count, next_secs, pending_failed_count;	unsigned int pending_full_resync_count, waiting_failed_count;	string_t *str = t_str_new(256);	memset(pending_counts, 0, sizeof(pending_counts));	pending_failed_count = 0; waiting_failed_count = 0;	pending_full_resync_count = 0;	user_count = 0;	iter = replicator_queue_iter_init(queue);	while ((user = replicator_queue_iter_next(iter)) != NULL) {		if (user->priority != REPLICATION_PRIORITY_NONE)			pending_counts[user->priority]++;		else if (replicator_queue_want_sync_now(queue, user, &next_secs)) {			if (user->last_sync_failed)				pending_failed_count++;			else				pending_full_resync_count++;		} else {			if (user->last_sync_failed)				waiting_failed_count++;		}		user_count++;	}	replicator_queue_iter_deinit(&iter);	for (priority = REPLICATION_PRIORITY_SYNC; priority > 0; priority--) {		str_printfa(str, "Queued '%s' requests/t%u/n",			    replicator_priority_to_str(priority),			    pending_counts[priority]);	}	str_printfa(str, "Queued 'failed' requests/t%u/n",		    pending_failed_count);	str_printfa(str, "Queued 'full resync' requests/t%u/n",		    pending_full_resync_count);	str_printfa(str, "Waiting 'failed' requests/t%u/n",		    waiting_failed_count);	str_printfa(str, "Total number of known users/t%u/n", user_count);	str_append_c(str, '/n');	o_stream_send(client->conn.output, str_data(str), str_len(str));	return 0;}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:50,


示例23: user_callback

static voiduser_callback(enum userdb_result result,	      struct auth_request *auth_request){	struct auth_master_connection *conn = auth_request->master;	string_t *str;	const char *value;	if (auth_request->userdb_lookup_tempfailed)		result = USERDB_RESULT_INTERNAL_FAILURE;	if (result == USERDB_RESULT_OK) {		if (user_verify_restricted_uid(auth_request) < 0)			result = USERDB_RESULT_INTERNAL_FAILURE;	}	str = t_str_new(128);	switch (result) {	case USERDB_RESULT_INTERNAL_FAILURE:		str_printfa(str, "FAIL/t%u", auth_request->id);		if (auth_request->userdb_lookup_tempfailed) {			value = auth_fields_find(auth_request->userdb_reply,						 "reason");			if (value != NULL)				str_printfa(str, "/treason=%s", value);		}		break;	case USERDB_RESULT_USER_UNKNOWN:		str_printfa(str, "NOTFOUND/t%u", auth_request->id);		break;	case USERDB_RESULT_OK:		str_printfa(str, "USER/t%u/t", auth_request->id);		str_append_tabescaped(str, auth_request->user);		str_append_c(str, '/t');		auth_fields_append(auth_request->userdb_reply, str,				   AUTH_FIELD_FLAG_HIDDEN, 0);		break;	}	if (conn->auth->set->debug) {		i_debug("userdb out: %s",			auth_master_reply_hide_passwords(conn, str_c(str)));	}	str_append_c(str, '/n');	o_stream_nsend(conn->output, str_data(str), str_len(str));	auth_request_unref(&auth_request);	auth_master_connection_unref(&conn);}
开发者ID:Dexus,项目名称:ubuntu-trusty-dovecot,代码行数:50,


示例24: client_export_mail_stats

static voidclient_export_mail_stats(string_t *str, const struct mail_stats *stats){#define MAIL_STATS_HEADER "/tuser_cpu/tsys_cpu/tclock_time" /	"/tmin_faults/tmaj_faults/tvol_cs/tinvol_cs" /	"/tdisk_input/tdisk_output" /	"/tread_count/tread_bytes/twrite_count/twrite_bytes" /	"/tmail_lookup_path/tmail_lookup_attr" /	"/tmail_read_count/tmail_read_bytes/tmail_cache_hits/n"	str_printfa(str, "/t%ld.%06u", (long)stats->user_cpu.tv_sec,		    (unsigned int)stats->user_cpu.tv_usec);	str_printfa(str, "/t%ld.%06u", (long)stats->sys_cpu.tv_sec,		    (unsigned int)stats->sys_cpu.tv_usec);	str_printfa(str, "/t%ld.%06u", (long)stats->clock_time.tv_sec,		    (unsigned int)stats->clock_time.tv_usec);	str_printfa(str, "/t%u/t%u", stats->min_faults, stats->maj_faults);	str_printfa(str, "/t%u/t%u", stats->vol_cs, stats->invol_cs);	str_printfa(str, "/t%llu/t%llu",		    (unsigned long long)stats->disk_input,		    (unsigned long long)stats->disk_output);	str_printfa(str, "/t%u/t%llu/t%u/t%llu",		    stats->read_count, (unsigned long long)stats->read_bytes,		    stats->write_count, (unsigned long long)stats->write_bytes);	str_printfa(str, "/t%u/t%u/t%u/t%llu/t%u",		    stats->mail_lookup_path, stats->mail_lookup_attr,		    stats->mail_read_count,		    (unsigned long long)stats->mail_read_bytes,		    stats->mail_cache_hits);}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:30,


示例25: get_disconnect_reason

static const char *get_disconnect_reason(struct cmd_append_context *ctx, uoff_t lit_offset){	string_t *str = t_str_new(128);	unsigned int secs = ioloop_time - ctx->started;	str_printfa(str, "Disconnected in APPEND (%u msgs, %u secs",		    ctx->count, secs);	if (ctx->literal_size > 0) {		str_printfa(str, ", %"PRIuUOFF_T"/%"PRIuUOFF_T" bytes",			    lit_offset, ctx->literal_size);	}	str_append_c(str, ')');	return str_c(str);}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:15,


示例26: fts_queue_index

static void fts_queue_index(struct mailbox *box){	struct mail_user *user = box->storage->user;	string_t *str = t_str_new(256);	const char *path, *value;	unsigned int max_recent_msgs;	int fd;	path = t_strconcat(user->set->base_dir, "/"INDEXER_SOCKET_NAME, NULL);	fd = net_connect_unix(path);	if (fd == -1) {		i_error("net_connect_unix(%s) failed: %m", path);		return;	}	value = mail_user_plugin_getenv(user, "fts_autoindex_max_recent_msgs");	if (value == NULL || str_to_uint(value, &max_recent_msgs) < 0)		max_recent_msgs = 0;	str_append(str, INDEXER_HANDSHAKE);	str_append(str, "APPEND/t0/t");	str_append_tabescaped(str, user->username);	str_append_c(str, '/t');	str_append_tabescaped(str, box->vname);	str_printfa(str, "/t%u", max_recent_msgs);	str_append_c(str, '/t');	str_append_tabescaped(str, box->storage->user->session_id);	str_append_c(str, '/n');	if (write_full(fd, str_data(str), str_len(str)) < 0)		i_error("write(%s) failed: %m", path);	i_close_fd(&fd);}
开发者ID:Raffprta,项目名称:core,代码行数:32,


示例27: get_exit_status_message

static const char *get_exit_status_message(struct service *service, enum fatal_exit_status status){	string_t *str;	switch (status) {	case FATAL_LOGOPEN:		return "Can't open log file";	case FATAL_LOGWRITE:		return "Can't write to log file";	case FATAL_LOGERROR:		return "Internal logging error";	case FATAL_OUTOFMEM:		str = t_str_new(128);		str_append(str, "Out of memory");		if (service->vsz_limit != 0) {			str_printfa(str, " (service %s { vsz_limit=%u MB }, "				    "you may need to increase it)",				    service->set->name,				    (unsigned int)(service->vsz_limit/1024/1024));		}		if (getenv("CORE_OUTOFMEM") == NULL)			str_append(str, " - set CORE_OUTOFMEM=1 environment to get core dump");		return str_c(str);	case FATAL_EXEC:		return "exec() failed";	case FATAL_DEFAULT:		return "Fatal failure";	}	return NULL;}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:33,


示例28: fetch_binary_size

static int fetch_binary_size(struct imap_fetch_context *ctx, struct mail *mail,			     struct imap_fetch_body_data *body){	string_t *str;	uoff_t size;	if (mail == NULL) {		imap_msgpart_free(&body->msgpart);		return 1;	}	if (imap_msgpart_size(mail, body->msgpart, &size) < 0)		return -1;	str = t_str_new(128);	if (ctx->state.cur_first)		ctx->state.cur_first = FALSE;	else		str_append_c(str, ' ');	str_printfa(str, "%s %"PRIuUOFF_T, get_body_name(body), size);	if (o_stream_send(ctx->client->output, str_data(str), str_len(str)) < 0)		return -1;	return 1;}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:25,


示例29: pop3_refresh_proctitle

void pop3_refresh_proctitle(void){	struct client *client;	string_t *title = t_str_new(128);	if (!verbose_proctitle)		return;	str_append_c(title, '[');	switch (pop3_client_count) {	case 0:		str_append(title, "idling");		break;	case 1:		client = pop3_clients;		str_append(title, client->user->username);		if (client->user->remote_ip != NULL) {			str_append_c(title, ' ');			str_append(title, net_ip2addr(client->user->remote_ip));		}		break;	default:		str_printfa(title, "%u connections", pop3_client_count);		break;	}	str_append_c(title, ']');	process_title_set(str_c(title));}
开发者ID:bdraco,项目名称:dovecot,代码行数:28,


示例30: client_input_status

static intclient_input_status(struct doveadm_connection *client, const char *const *args){	struct replicator_queue_iter *iter;	struct replicator_user *user;	const char *mask = args[0];	string_t *str = t_str_new(128);	if (mask == NULL)		return client_input_status_overview(client);	iter = replicator_queue_iter_init(client->queue);	while ((user = replicator_queue_iter_next(iter)) != NULL) {		if (!wildcard_match(user->username, mask))			continue;		str_truncate(str, 0);		str_append_tabescaped(str, user->username);		str_append_c(str, '/t');		str_append(str, replicator_priority_to_str(user->priority));		str_printfa(str, "/t%lld/t%lld/t%d/n",			    (long long)user->last_fast_sync,			    (long long)user->last_full_sync,			    user->last_sync_failed);		o_stream_send(client->conn.output, str_data(str), str_len(str));	}	replicator_queue_iter_deinit(&iter);	o_stream_send(client->conn.output, "/n", 1);	return 0;}
开发者ID:Distrotech,项目名称:dovecot,代码行数:30,



注:本文中的str_printfa函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ str_ptr函数代码示例
C++ str_printf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。