当前位置: 首页>>代码示例>>C++>>正文


C++ err_str函数代码示例

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


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

示例1: m_rawto

DLLFUNC int m_rawto(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	aClient *acptr = NULL;
	if (!IsULine(sptr))
	{
		sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
		return -1;
	}
	if (parc < 3)
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "RAWTO");
		return -1;
	}
	if ((acptr = find_client(parv[1], NULL)))
	{
		if (MyConnect(acptr))
		{
			sendto_one(acptr, "%s", parv[2]);
			return 0;
		}		
		else
		{
			sendto_one(acptr, ":%s %s %s :%s",
				parv[0], IsToken(acptr->from) ? TOK_RAWTO : MSG_RAWTO,
					parv[1], parv[2]);
			return 0;
		}
	}
	return 0;
}
开发者ID:Hamper,项目名称:LineIRCd,代码行数:31,代码来源:m_rawto.c

示例2: CMD_FUNC

/*
 * m_samode
 * parv[0] = sender
 * parv[1] = channel
 * parv[2] = modes
 * -t
 */
DLLFUNC CMD_FUNC(m_samode)
{
	aChannel *chptr;

	if (!IsPrivileged(cptr) || !IsSAdmin(sptr))
	{
		sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
		return 0;
	}

	if (parc > 2)
	{
		chptr = find_channel(parv[1], NullChn);
		if (chptr == NullChn)
			return 0;
	}
	else
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "SAMODE");
		return 0;
	}
	opermode = 0;
	(void)do_mode(chptr, cptr, sptr, parc - 2, parv + 2, 0, 1);

	return 0;
}
开发者ID:JourneymanGeek,项目名称:rabbitircd,代码行数:34,代码来源:m_samode.c

示例3: memAccess

Boolean memAccess(ArmMem* mem, UInt32 addr, UInt8 size, Boolean write, void* buf){

	UInt8 i;

	for(i = 0; i < MAX_MEM_REGIONS; i++){
		if(mem->regions[i].pa <= addr && mem->regions[i].pa + mem->regions[i].sz > addr){

			return mem->regions[i].aF(mem->regions[i].uD, addr, size, write & 0x7F, buf);
		}
	}

	if(!(write & 0x80)){	//high bit in write tells us to not print this error (used by gdb stub)

		err_str("Memory ");
		err_str(write ? "write" : "read");
		err_str(" of ");
		err_dec(size);
		err_str(" bytes at physical addr 0x");
		err_hex(addr);
		err_str(" fails, halting\r\n");
		while(1);
	}

	return false;
}
开发者ID:Fadis,项目名称:uARM,代码行数:25,代码来源:mem.c

示例4: m_lag

DLLFUNC int m_lag(aClient *cptr, aClient *sptr, int parc, char *parv[])
{

	if (MyClient(sptr))
		if (!IsAnOper(sptr))
		{
			sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
			    parv[0]);
			return 0;
		}

	if (parc < 2)
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "LAG");
		return 0;
	}
	if (*parv[1] == '\0')
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "LAG");
		return 0;
	}
	if (hunt_server_token(cptr, sptr, MSG_LAG, TOK_LAG, ":%s", 1, parc,
	    parv) == HUNTED_NOSUCH)
	{
		return 0;
	}

	sendto_one(sptr, ":%s NOTICE %s :Lag reply -- %s %s %li",
	    me.name, sptr->name, me.name, parv[1], TStime());

	return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:34,代码来源:m_lag.c

示例5: delta_mjpeg_check_status

static bool delta_mjpeg_check_status(struct delta_ctx *pctx,
				     struct jpeg_decode_return_params_t *status)
{
	struct delta_dev *delta = pctx->dev;
	bool dump = false;

	if (status->error_code == JPEG_DECODER_NO_ERROR)
		goto out;

	if (is_stream_error(status->error_code)) {
		dev_warn_ratelimited(delta->dev,
				     "%s  firmware: stream error @ frame %d (%s)\n",
				     pctx->name, pctx->decoded_frames,
				     err_str(status->error_code));
		pctx->stream_errors++;
	} else {
		dev_warn_ratelimited(delta->dev,
				     "%s  firmware: decode error @ frame %d (%s)\n",
				     pctx->name, pctx->decoded_frames,
				     err_str(status->error_code));
		pctx->decode_errors++;
		dump = true;
	}

out:
	dev_dbg(delta->dev,
		"%s  firmware: decoding time(us)=%d\n", pctx->name,
		status->decode_time_in_us);

	return dump;
}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:31,代码来源:delta-mjpeg-dec.c

示例6: CMD_FUNC

/*
** m_whowas
**      parv[0] = sender prefix
**      parv[1] = nickname queried
*/
DLLFUNC CMD_FUNC(m_whowas)
{
	aWhowas *temp;
	int  cur = 0;
	int  max = -1, found = 0;
	char *p, *nick;

	if (parc < 2)
	{
		sendto_one(sptr, err_str(ERR_NONICKNAMEGIVEN),
		    me.name, parv[0]);
		return 0;
	}
	if (parc > 2)
		max = atoi(parv[2]);
	if (parc > 3)
		if (hunt_server_token(cptr, sptr, MSG_WHOWAS, TOK_WHOWAS, "%s %s :%s", 3, parc,
		    parv))
			return 0;

	if (!MyConnect(sptr) && (max > 20))
		max = 20;

	p = (char *)strchr(parv[1], ',');
	if (p)
		*p = '\0';
	nick = parv[1];
	temp = WHOWASHASH[hash_whowas_name(nick)];
	found = 0;
	for (; temp; temp = temp->next)
	{
		if (!mycmp(nick, temp->name))
		{
			sendto_one(sptr, rpl_str(RPL_WHOWASUSER),
			    me.name, parv[0], temp->name,
			    temp->username,
			    (IsOper(sptr) ? temp->hostname :
			    (*temp->virthost !=
			    '\0') ? temp->virthost : temp->hostname),
			    temp->realname);
                	if (!((Find_uline(temp->servername)) && !IsOper(sptr) && HIDE_ULINES))
				sendto_one(sptr, rpl_str(RPL_WHOISSERVER), me.name,
				    parv[0], temp->name, temp->servername,
				    myctime(temp->logoff));
			cur++;
			found++;
		}
		if (max > 0 && cur >= max)
			break;
	}
	if (!found)
		sendto_one(sptr, err_str(ERR_WASNOSUCHNICK),
		    me.name, parv[0], nick);

	sendto_one(sptr, rpl_str(RPL_ENDOFWHOWAS), me.name, parv[0], parv[1]);
	return 0;
}
开发者ID:Hamper,项目名称:LineIRCd,代码行数:62,代码来源:m_whowas.c

示例7: m_pong

/*
** m_pong
**	parv[0] = sender prefix
**	parv[1] = origin
**	parv[2] = destination
*/
DLLFUNC int m_pong(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	aClient *acptr;
	char *origin, *destination;

#ifdef NOSPOOF
	if (!IsRegistered(cptr))
		return m_nospoof(cptr, sptr, parc, parv);
#endif

	if (parc < 2 || *parv[1] == '\0')
	{
		sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]);
		return 0;
	}

	origin = parv[1];
	destination = parv[2];
	cptr->flags &= ~FLAGS_PINGSENT;
	sptr->flags &= ~FLAGS_PINGSENT;

	/* Remote pongs for clients? uhh... */
	if (MyClient(sptr) || !IsRegistered(sptr))
		destination = NULL;

	if (!BadPtr(destination) && mycmp(destination, me.name) != 0)
	{
		if ((acptr = find_client(destination, NULL)) ||
		    (acptr = find_server_quick(destination)))
		{
			if (!IsServer(cptr) && !IsServer(acptr))
			{
				sendto_one(sptr, err_str(ERR_NOSUCHSERVER),
				    me.name, parv[0], destination);
				return 0;
			}
			else
				sendto_one(acptr, ":%s PONG %s %s",
				    parv[0], origin, destination);
		}
		else
		{
			sendto_one(sptr, err_str(ERR_NOSUCHSERVER),
			    me.name, parv[0], destination);
			return 0;
		}
	}
#ifdef	DEBUGMODE
	else
		Debug((DEBUG_NOTICE, "PONG: %s %s", origin,
		    destination ? destination : "*"));
#endif
	return 0;
}
开发者ID:cyocom,项目名称:Technokats-Website,代码行数:60,代码来源:m_pingpong.c

示例8: add_listmode

int add_listmode(Ban **list, aClient *cptr, aChannel *chptr, char *banid)
{
	Ban *ban;
	int cnt = 0, len;

	if (MyClient(cptr))
		(void)collapse(banid);
	
	len = strlen(banid);
	if (!*list && ((len > MAXBANLENGTH) || (MAXBANS < 1)))
	{
		sendto_one(cptr, err_str(ERR_BANLISTFULL),
			me.name, cptr->name, chptr->chname, banid);
		return -1;
	}
	for (ban = *list; ban; ban = ban->next)
	{
		len += strlen(ban->banstr);
		if (MyClient(cptr))
			if ((len > MAXBANLENGTH) || (++cnt >= MAXBANS))
			{
				sendto_one(cptr, err_str(ERR_BANLISTFULL),
				    me.name, cptr->name, chptr->chname, banid);
				return -1;
			}
			else
			{
#ifdef SOCALLEDSMARTBANNING
			  /* Temp workaround added in b19. -- Syzop */
			  if (!mycmp(ban->banstr, banid) || (!strchr(banid, '\\') && !strchr(ban->banstr, '\\')))
				if (!match(ban->banstr, banid))
					return -1;
#endif
			  if (!mycmp(ban->banstr, banid))
			  	return -1;
			}
		else if (!mycmp(ban->banstr, banid))
			return -1;

	}
	ban = make_ban();
	bzero((char *)ban, sizeof(Ban));
	ban->next = *list;
	ban->banstr = (char *)MyMalloc(strlen(banid) + 1);
	(void)strcpy(ban->banstr, banid);
	ban->who = (char *)MyMalloc(strlen(cptr->name) + 1);
	(void)strcpy(ban->who, cptr->name);
	ban->when = TStime();
	*list = ban;
	return 0;
}
开发者ID:HengeSense,项目名称:Technokats-Website,代码行数:51,代码来源:channel.c

示例9: CMD_FUNC

DLLFUNC CMD_FUNC(m_starttls)
{
	if (!MyConnect(sptr) || !IsUnknown(sptr))
		return 0;
#ifndef USE_SSL
	/* sendnotice(sptr, "This server does not support SSL"); */
	/* or numeric 691? */
	/* actually... it's probably best to just act like we don't know this command...? */
	sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "STARTTLS");
	return 0;
#else
	if (iConf.ssl_options & SSLFLAG_NOSTARTTLS)
	{
		sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "STARTTLS");
		return 0;
	}
	if (IsSecure(sptr))
	{
		sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed. Already using TLS.");
		return 0;
	}
	dbuf_delete(&sptr->recvQ, 1000000); /* Clear up any remaining plaintext commands */
	sendto_one(sptr, rpl_str(RPL_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*");
	send_queued(sptr);

	SetSSLStartTLSHandshake(sptr);
	Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", sptr->sockhost));
	if ((sptr->ssl = SSL_new(ctx_server)) == NULL)
		goto fail;
	sptr->flags |= FLAGS_SSL;
	SSL_set_fd(sptr->ssl, sptr->fd);
	SSL_set_nonblocking(sptr->ssl);
	if (!ircd_SSL_accept(sptr, sptr->fd)) {
		Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", sptr->sockhost));
		SSL_set_shutdown(sptr->ssl, SSL_RECEIVED_SHUTDOWN);
		SSL_smart_shutdown(sptr->ssl);
		SSL_free(sptr->ssl);
		goto fail;
	}

	/* HANDSHAKE IN PROGRESS */
	return 0;
fail:
	/* Failure */
	sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed");
	sptr->ssl = NULL;
	sptr->flags &= ~FLAGS_SSL;
	SetUnknown(sptr);
	return 0;
#endif
}
开发者ID:JourneymanGeek,项目名称:rabbitircd,代码行数:51,代码来源:m_starttls.c

示例10: out

static void out (avatar_s *avatar, int rc)
{
	if (avatar) {
		format(" OUT %s<%d> %s=%s",
			avatar->av_name, current->pid, avatar->av_last_op,
			err_str(rc));
	} else {
		format(" OUT <no avatar><%d> %s",
			current->pid, err_str(rc));
	}
	if (rc) {
		format("[%d]", rc);
	}
}
开发者ID:taysom,项目名称:tau,代码行数:14,代码来源:msg_debug.c

示例11: m_sdesc

int m_sdesc(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	if (!IsAdmin(sptr) && !IsCoAdmin(sptr))
	{
		sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
		return 0;
	}
	
	if (parc < 2)
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, sptr->name, "SDESC");
		return 0;
	}

	if (strlen(parv[1]) < 1)
		if (MyConnect(sptr))
		{
			sendto_one(sptr,
			    ":%s NOTICE %s :*** Nothing to change to (SDESC)",
			    me.name, sptr->name);
			return 0;
		}
	if (strlen(parv[1]) > (REALLEN))
	{
		if (MyConnect(sptr))
		{
			sendto_one(sptr,
			    ":%s NOTICE %s :*** /SDESC Error: \"Server info\" may maximum be %i characters of length",
			    me.name, sptr->name, REALLEN);
		}
		return 0;
	}

	ircsprintf(sptr->srvptr->info, "%s", parv[1]);

	sendto_serv_butone_token(cptr, sptr->name, MSG_SDESC, TOK_SDESC, ":%s",
	    parv[1]);

	if (MyConnect(sptr))
	{
		sendto_one(sptr,
		    ":%s NOTICE %s :Your \"server description\" is now set to be %s - you have to set it manually to undo it",
		    me.name, parv[0], parv[1]);
		return 0;
	}
	sendto_ops("Server description for %s is now '%s' changed by %s",
	    sptr->srvptr->name, sptr->srvptr->info, parv[0]);
	return 0;
}
开发者ID:SwiftIRC,项目名称:ircd,代码行数:49,代码来源:m_sdesc.c

示例12: CMD_FUNC

/* Remove a temporary dccdeny line
 * parv[0] - sender
 * parv[1] - file/mask
 */
DLLFUNC CMD_FUNC(m_undccdeny)
{
	ConfigItem_deny_dcc *p;
	if (!MyClient(sptr))
		return 0;

	if (!IsAnOper(sptr) || !OPCanDCCDeny(sptr))
	{
		sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
		return 0;
	}

	if (parc < 2)
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0],
		    "UNDCCDENY");
		return 0;
	}

	if (BadPtr(parv[1]))
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0],
		    "UNDCCDENY");
		return 0;
	}
/* If we find an exact match even if it is a wild card only remove the exact match -- codemastr */
	if ((p = Find_deny_dcc(parv[1])) && p->flag.type2 == CONF_BAN_TYPE_TEMPORARY)
	{
		sendto_ops("%s removed a temp dccdeny for %s", parv[0],
		    parv[1]);
		DCCdeny_del(p);
		return 1;
	}
/* Next search using the wild card -- codemastr */
/* Uncommented by Stskeeps:
	else if (dcc_del_wild_match(parv[1]) == 1)
		sendto_ops
		    ("%s removed a temp dccdeny for all dccdenys matching %s",
		    parv[0], parv[1]);
*/
/* If still no match, give an error */
	else
		sendto_one(sptr,
		    "NOTICE %s :*** Unable to find a temp dccdeny matching %s",
		    parv[0], parv[1]);
	return 0;

}
开发者ID:cyocom,项目名称:Technokats-Website,代码行数:52,代码来源:m_undccdeny.c

示例13: find_client

/*
** find_chasing
**	Find the client structure for a nick name (user) using history
**	mechanism if necessary. If the client is not found, an error
**	message (NO SUCH NICK) is generated. If the client was found
**	through the history, chasing will be 1 and otherwise 0.
*/
aClient *find_chasing(aClient *sptr, char *user, int *chasing)
{
	aClient *who = find_client(user, (aClient *)NULL);

	if (chasing)
		*chasing = 0;
	if (who)
	{
		if (!IsServer(who))
			return who;
		else
			return NULL;
	}
	if (!(who = get_history(user, (long)KILLCHASETIMELIMIT)))
	{
		sendto_one(sptr, err_str(ERR_NOSUCHNICK),
		    me.name, sptr->name, user);
		return NULL;
	}
	if (chasing)
		*chasing = 1;
	if (!IsServer(who))
		return who;
	else return NULL;
}
开发者ID:HengeSense,项目名称:Technokats-Website,代码行数:32,代码来源:channel.c

示例14: lua_co_create

static u32 lua_co_create(LSTATE) {
  lclosure_t *function = lstate_getfunction(0);
  if (function->type != LUAF_LUA) {
    err_str(0, "Lua function expected");
  }
  lthread_t *thread = gc_alloc(sizeof(lthread_t), LTHREAD);
  thread->status = CO_NEVER_RUN;
  thread->stack  = mmap(NULL, CO_STACK_SIZE, PROT_WRITE | PROT_READ,
                        MAP_ANON | MAP_PRIVATE, -1, 0);
  xassert(thread->stack != MAP_FAILED);

  thread->caller  = NULL;
  thread->closure = function;
  thread->frame   = NULL;
  thread->env     = cur_thread->env;
  thread->argvi   = 0;
  thread->argc    = 0;
  vm_stack_init(&thread->vm_stack, 20);

  size_t *stack = (size_t*) ((size_t) thread->stack + CO_STACK_SIZE);
  /* Bogus return address, and then actual address to return to */
  size_t spaces = CALLEE_REGS + 2;
  memset(stack - spaces, 0, sizeof(size_t) * spaces);
  *(stack - 1) = 0;
  *(stack - 2) = (size_t) coroutine_wrapper;
  thread->curstack = stack - spaces;

  lstate_return1(lv_thread(thread));
}
开发者ID:robbiemc,项目名称:joule,代码行数:29,代码来源:coroutine.c

示例15: arr

void ClientSocket::send(const std::vector<unsigned char>& buff) {
  uint64_t written = 0;
  std::string arr(buff.begin(), buff.end());
  while (written < arr.length()) {
    //Wait for the socket to become ready (we will block on sends for 1 second)
    pollfd fds;
    fds.fd = sock_fd;
    fds.events = POLLOUT;
    poll(&fds, 1, 1000);
    if ( (fds.revents & POLLOUT) != POLLOUT) {
      throw temporarily_unavailable();
    }

    //Send the previously unsent portions of the message.
    int result = ::send(sock_fd, arr.c_str()+written, arr.length() - written, MSG_NOSIGNAL);
    if (-1 == result) {
      std::string err_str(strerror(errno));
      if (err_str == "Broken pipe") {
        err_str = "Connection closed by receiver (broken pipe)";
      }
      err_str = "Error sending data over socket: " + err_str;
      //Clean up the socket (close connection and file descriptor)
      socketCleanup(sock_fd);
      throw std::runtime_error(err_str);
    }
    else {
      written += result;
    }
  }
  return;
}
开发者ID:OwlPlatform,项目名称:cpp-owl-common,代码行数:31,代码来源:simple_sockets.cpp


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