• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ putmsg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main (void)
{
	int fd;
	struct strbuf control;
	struct strbuf data;
	struct log_ctl log;
	char *message = "Danger Will Robinson!";

	if ((fd = open ("/dev/log", O_WRONLY)) == -1)
		err_msg ("Can't open /dev/log");

	control.maxlen = sizeof (log);
	control.len = sizeof (log);
	control.buf = (caddr_t) &log;

	data.maxlen = strlen (message);
	data.len = strlen (message);
	data.buf = message;

	log.level = 42;
	log.flags = SL_TRACE | SL_ERROR | SL_FATAL;

	if (putmsg (fd, &control, &data, 0) == -1)
		err_msg ("putmsg failed");

	return (0);
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:27,代码来源:genlog.c


示例2: tap_write

int tap_write(int fd, char *buf, int len)
{
    struct strbuf sbuf;
    sbuf.len = len;      
    sbuf.buf = buf;      
    return putmsg(fd, NULL, &sbuf, 0) >= 0 ? sbuf.len : -1;
}
开发者ID:huangmingyou,项目名称:vtun,代码行数:7,代码来源:tap_dev.c


示例3: DlipPromiscuous

// Set to promiscuous mode
bool DlipPromiscuous(int fd, UINT level)
{
	dl_promiscon_req_t req;
	struct strbuf ctl;
	int flags;
	// Validate arguments
	if (fd == -1)
	{
		return false;
	}

	Zero(&req, sizeof(req));
	req.dl_primitive = DL_PROMISCON_REQ;
	req.dl_level = level;

	Zero(&ctl, sizeof(ctl));
	ctl.maxlen = 0;
	ctl.len = sizeof(req);
	ctl.buf = (char *)&req;

	flags = 0;

	if (putmsg(fd, &ctl, NULL, flags) < 0)
	{
		return false;
	}

	return true;
}
开发者ID:AlexeyBychkov,项目名称:SoftEtherVPN,代码行数:30,代码来源:BridgeUnix.c


示例4: ctrlc_set

ctrlc_set(int4 dummy_param)
{
	int4		status;
	msgtype		message;
	error_def(ERR_LASTFILCMPLD);

	if (!IS_MCODE_RUNNING)
	{
		message.arg_cnt = 4;
		message.def_opts = message.new_opts = 0;
		message.msg_number = ERR_LASTFILCMPLD;
		message.fp_cnt = 2;
		message.fp[0].n = strlen(source_file_name);
		message.fp[1].cp = source_file_name;
		sys$putmsg(&message, 0, 0, 0);
	} else if (!outofband)
	{
		if (ctrlc_on)
		{
			status = sys$setef(efn_outofband);
			assert(SS$_WASCLR == status);
			if (status != SS$_WASCLR && status != SS$_WASSET)
				GTMASSERT;
			ctrap_action_is = 0;
			outofband = ctrlc;
			xfer_table[xf_linefetch] = op_fetchintrrpt;
			xfer_table[xf_linestart] = op_startintrrpt;
			xfer_table[xf_zbfetch] = op_fetchintrrpt;
			xfer_table[xf_zbstart] = op_startintrrpt;
			xfer_table[xf_forchk1] = op_startintrrpt;
			xfer_table[xf_forloop] = op_forintrrpt;
			sys$wake(0,0);
		}
	}
}
开发者ID:ChristyV,项目名称:fis-gtm,代码行数:35,代码来源:ctrlc_set.c


示例5: dlunitdatareq

void dlunitdatareq(int fd, u_char *addrp, int addrlen, u_long minpri, u_long maxpri, u_char *datap, int datalen)
{
	long    buf[MAXDLBUF];
	union   DL_primitives   *dlp;
	struct  strbuf  data, ctl;

	dlp = (union DL_primitives*) buf;

	dlp->unitdata_req.dl_primitive = DL_UNITDATA_REQ;
	dlp->unitdata_req.dl_dest_addr_length = addrlen;
	dlp->unitdata_req.dl_dest_addr_offset = sizeof (dl_unitdata_req_t);
	dlp->unitdata_req.dl_priority.dl_min = minpri;
	dlp->unitdata_req.dl_priority.dl_max = maxpri;

	(void) memcpy(OFFADDR(dlp, sizeof (dl_unitdata_req_t)), addrp, addrlen);

	ctl.maxlen = 0;
	ctl.len = sizeof (dl_unitdata_req_t) + addrlen;
	ctl.buf = (char *) buf;

	data.maxlen = 0;
	data.len = datalen;
	data.buf = (char *) datap;

	if (putmsg(fd, &ctl, &data, 0) < 0)
		fatalSys("dlunitdatareq:  putmsg");
}
开发者ID:springware,项目名称:92u8,代码行数:27,代码来源:if.c


示例6: dlpi_msg

static int
dlpi_msg(int fd, union DL_primitives *dlp, int rlen, int flags,
    int ack, int alen, int size)
{
	struct strbuf ctl;

	ctl.maxlen = 0;
	ctl.len = rlen;
	ctl.buf = (caddr_t)dlp;
	
	if (putmsg(fd, &ctl, NULL, flags) < 0)
		return (-1);
	
	ctl.maxlen = size;
	ctl.len = 0;
	
	flags = 0;

	if (getmsg(fd, &ctl, NULL, &flags) < 0)
		return (-1);
	
	if (dlp->dl_primitive != ack || ctl.len < alen)
		return (-1);
	
	return (0);
}
开发者ID:LindyLo,项目名称:CrossCompileLibrary,代码行数:26,代码来源:eth-dlpi.c


示例7: dlrawdatareq

/*
 * There's an ack *if* there's an error.
 */
static int
dlrawdatareq(int fd, const u_char *datap, int datalen)
{
	struct strbuf ctl, data;
	long buf[MAXDLBUF];	/* XXX - char? */
	union DL_primitives *dlp;
	int dlen;

	dlp = MAKE_DL_PRIMITIVES(buf);

	dlp->dl_primitive = DL_HP_RAWDATA_REQ;
	dlen = DL_HP_RAWDATA_REQ_SIZE;

	/*
	 * HP's documentation doesn't appear to show us supplying any
	 * address pointed to by the control part of the message.
	 * I think that's what raw mode means - you just send the raw
	 * packet, you don't specify where to send it to, as that's
	 * implied by the destination address.
	 */
	ctl.maxlen = 0;
	ctl.len = dlen;
	ctl.buf = (void *)buf;

	data.maxlen = 0;
	data.len = datalen;
	data.buf = (void *)datap;

	return (putmsg(fd, &ctl, &data, 0));
}
开发者ID:EIChaoYang,项目名称:libpcap,代码行数:33,代码来源:pcap-dlpi.c


示例8: DlipAttatchRequest

// Attach to the device
bool DlipAttatchRequest(int fd, UINT devid)
{
	dl_attach_req_t req;
	struct strbuf ctl;
	int flags;
	// Validate arguments
	if (fd == -1)
	{
		return false;
	}

	Zero(&req, sizeof(req));
	req.dl_primitive = DL_ATTACH_REQ;
	req.dl_ppa = devid;

	Zero(&ctl, sizeof(ctl));
	ctl.maxlen = 0;
	ctl.len = sizeof(req);
	ctl.buf = (char *)&req;

	flags = 0;

	if (putmsg(fd, &ctl, NULL, flags) < 0)
	{
		return false;
	}

	return true;
}
开发者ID:AlexeyBychkov,项目名称:SoftEtherVPN,代码行数:30,代码来源:BridgeUnix.c


示例9: DlipBindRequest

// Bind to a SAP
bool DlipBindRequest(int fd)
{
	dl_bind_req_t	req;
	struct strbuf ctl;

	if (fd == -1)
	{
		return false;
	}

	Zero(&req, sizeof(req));
	req.dl_primitive = DL_BIND_REQ;
	req.dl_service_mode = DL_CLDLS;
	req.dl_sap = 0;

	Zero(&ctl, sizeof(ctl));
	ctl.maxlen = 0;
	ctl.len = sizeof(req);
	ctl.buf = (char *)&req;

	if (putmsg(fd, &ctl, NULL, 0) < 0)
	{
		return false;
	}
	return true;
}
开发者ID:AlexeyBychkov,项目名称:SoftEtherVPN,代码行数:27,代码来源:BridgeUnix.c


示例10: fprintf

FILE *ed_open(char *fname, char *mode, char set_fattrs)
	/* get file attributes ? 1=yes, 0=no */
	{
	register FILE *fp;

	if(ed_fp) {
		fprintf( stderr,"Panic...ed_fp left open\n");
		exit( -1 );
		}

	unbreakable();
	fp = fopen(fname, mode);
	
	if(fp == 0) {
		if(openerrflag)
			putmsg("Unable to access file");
		breakable();
		return(0);
		}

	ed_fp = fp;

	if (set_fattrs)		
		get_fattrs(ed_fp);

	breakable();

	return(fp);
	}
开发者ID:vocho,项目名称:openqnx,代码行数:29,代码来源:ed_open.c


示例11: Message_encode

/*
 * call-seq:
 *     MessageClass.encode(msg) => bytes
 *
 * Encodes the given message object to its serialized form in protocol buffers
 * wire format.
 */
VALUE Message_encode(VALUE klass, VALUE msg_rb) {
  VALUE descriptor = rb_ivar_get(klass, descriptor_instancevar_interned);
  Descriptor* desc = ruby_to_Descriptor(descriptor);

  stringsink sink;
  stringsink_init(&sink);

  {
    const upb_handlers* serialize_handlers =
        msgdef_pb_serialize_handlers(desc);

    stackenv se;
    upb_pb_encoder* encoder;
    VALUE ret;

    stackenv_init(&se, "Error occurred during encoding: %s");
    encoder = upb_pb_encoder_create(&se.env, serialize_handlers, &sink.sink);

    putmsg(msg_rb, desc, upb_pb_encoder_input(encoder), 0);

    ret = rb_str_new(sink.ptr, sink.len);

    stackenv_uninit(&se);
    stringsink_uninit(&sink);

    return ret;
  }
}
开发者ID:1nf1corp,项目名称:protobuf,代码行数:35,代码来源:encode_decode.c


示例12: cannotopen

void
cannotopen(char *file)
{
	char	msg[MSGLEN + 1];

	(void) sprintf(msg, "Cannot open file %s", file);
	putmsg(msg);
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:8,代码来源:main.c


示例13: show_msghdr

void sbbs_t::show_msg(smbmsg_t* msg, long mode)
{
	char*	text;

	show_msghdr(msg);

	if((text=smb_getmsgtxt(&smb,msg,/* body and hfields: */0))!=NULL) {
		if(!(console&CON_RAW_IN))
			mode|=P_WORDWRAP;
		putmsg(text, mode);
		smb_freemsgtxt(text);
	}
	if((text=smb_getmsgtxt(&smb,msg,GETMSGTXT_TAIL_ONLY))!=NULL) {
		putmsg(text, mode&(~P_WORDWRAP));
		smb_freemsgtxt(text);
	}
}
开发者ID:kindy,项目名称:synchronet-bbs-1,代码行数:17,代码来源:getmsg.cpp


示例14: myperror

void
myperror(char *text)
{
	char	msg[MSGLEN + 1];	/* message */

	(void) sprintf(msg, "%s: %s", text, strerror(errno));
	putmsg(msg);
}
开发者ID:pcd1193182,项目名称:openzfs,代码行数:8,代码来源:display.c


示例15: move_player

void move_player(enum direction direction){
    int x, y, ele;
    int xx, yy;
    struct square *from, *to;
    struct tile *tilefrom, *tileto;

    x = xx = player.x;
    y = yy = player.y;
    ele = player.ele;
    switch(direction){
        case(NW):
            xx = x - 1;
        case(N):
            yy = y - 1;
            break;
        case(SW):
            yy = y + 1;
        case(W):
            xx = x - 1;
            break;
        case(SE):
            xx = x + 1;
        case(S):
            yy = y + 1;
            break;
        case(NE):
            yy = y - 1;
        case(E):
            xx = x + 1;
            break;
    }
    tilefrom = get_tile(pos_div(x, TILESIZE), pos_div(y, TILESIZE), 0);
    if(pos_div(x, TILESIZE) == pos_div(xx, TILESIZE) && pos_div(y, TILESIZE) == pos_div(yy, TILESIZE))
        tileto = tilefrom;
    else
        tileto = get_tile(pos_div(xx, TILESIZE), pos_div(yy, TILESIZE), 0);
    from = tilefrom->type == Array? SQUARE(tilefrom->tile.sq, pos_mod(x, TILESIZE), pos_mod(y, TILESIZE)) : tilefrom->tile.fill;
    to = tileto->type == Array? SQUARE(tileto->tile.sq, pos_mod(xx, TILESIZE), pos_mod(yy, TILESIZE)) : tileto->tile.fill;
    // TODO handle elevation / going to adjacent layers
    if(to->c){
        // TODO FIGHT or do other things I guess
        hit(to->c,&player);
    }
    else {
        // try moving
        switch(to->terrain){
            case(TERRAIN_ROCK_WALL):
                putmsg("You bump into a wall.");
                break;
            default:
                from->c = 0;
                player.x = xx;
                player.y = yy;
                to->c = &player;
                draw_map(xx, yy, ele);
        }
    }
}
开发者ID:codl,项目名称:ponyrl,代码行数:58,代码来源:player.c


示例16: tun_send

ssize_t
tun_send(tun_t *tun, const void *buf, size_t size)
{
	struct strbuf sbuf;

	sbuf.buf = buf;
	sbuf.len = size;
	return (putmsg(tun->fd, NULL, &sbuf, 0) >= 0 ? sbuf.len : -1);
}
开发者ID:AlexandreFournier,项目名称:libdnet,代码行数:9,代码来源:tun-solaris.c


示例17: getfilepath

void sbbs_t::fileinfo(file_t* f)
{
	char	ext[513];
	char 	tmp[512];
	char	path[MAX_PATH+1];
	char	fpath[MAX_PATH+1];
	uint	i,j;

	for(i=0;i<usrlibs;i++)
		if(usrlib[i]==cfg.dir[f->dir]->lib)
			break;
	for(j=0;j<usrdirs[i];j++)
		if(usrdir[i][j]==f->dir)
			break;

	getfilepath(&cfg,f,path);
	bprintf(text[FiLib],i+1,cfg.lib[cfg.dir[f->dir]->lib]->lname);
	bprintf(text[FiDir],j+1,cfg.dir[f->dir]->lname);
	bprintf(text[FiFilename],getfname(path));
	SAFECOPY(fpath,path);
	fexistcase(fpath);
	if(strcmp(path,fpath) && strcmp(f->desc,getfname(fpath)))	/* Different "actual" filename */
		bprintf(text[FiFilename],getfname(fpath));

	if(f->size!=-1L)
		bprintf(text[FiFileSize],ultoac(f->size,tmp));
	bprintf(text[FiCredits]
		,(cfg.dir[f->dir]->misc&DIR_FREE || !f->cdt) ? "FREE" : ultoac(f->cdt,tmp));
	bprintf(text[FiDescription],f->desc);
	bprintf(text[FiUploadedBy],f->misc&FM_ANON ? text[UNKNOWN_USER] : f->uler);
	if(f->date)
		bprintf(text[FiFileDate],timestr(&f->date));
	bprintf(text[FiDateUled],timestr(&f->dateuled));
	bprintf(text[FiDateDled],f->datedled ? timestr(&f->datedled) : "Never");
	bprintf(text[FiTimesDled],f->timesdled);
	if(f->size!=-1L)
		bprintf(text[FiTransferTime],sectostr(f->timetodl,tmp));
	if(f->altpath) {
		if(f->altpath<=cfg.altpaths) {
			if(SYSOP)
				bprintf(text[FiAlternatePath],cfg.altpath[f->altpath-1]); 
		}
		else
			bprintf(text[InvalidAlternatePathN],f->altpath); 
	}
	CRLF;
	if(f->misc&FM_EXTDESC) {
		getextdesc(&cfg,f->dir,f->datoffset,ext);
		CRLF;
		putmsg(ext,P_NOATCODES);
		CRLF; }
	if(f->size==-1L)
		bprintf(text[FileIsNotOnline],f->name);
	if(f->opencount)
		bprintf(text[FileIsOpen],f->opencount,f->opencount>1 ? "s" : nulstr);

}
开发者ID:ftnapps,项目名称:pkg-sbbs,代码行数:57,代码来源:file.cpp


示例18: dlpi_req

static int dlpi_req (struct dlpi_driver_data *dlpi, void *req, int reqlen,
		     int ackprim, void **ack, int *acklen) {
  struct strbuf ctlptr;
  int len, ret, flags;
  dl_error_ack_t *err_ack;
  
  ctlptr.maxlen = 0;
  ctlptr.len = reqlen;
  ctlptr.buf = req;
  
  if (putmsg(dlpi->fd, &ctlptr, NULL, 0) < 0) {
    ifstat_perror("putmsg");
    return 0;
  }
  
  ctlptr.maxlen = dlpi->maxlen;
  ctlptr.buf = (char *) dlpi->buf;
  ctlptr.len = 0;
  
  len = 0;
  flags = 0;
  while ((ret = getmsg(dlpi->fd, &ctlptr, NULL, &flags)) == MORECTL) {
    /* duplicate size of buf */
    dlpi->maxlen *= 2;
    if ((dlpi->buf = realloc(dlpi->buf, dlpi->maxlen)) == NULL) {
      ifstat_perror("malloc");
      return 0;
    }
    len += ctlptr.len;
    ctlptr.buf = (char *) dlpi->buf + len;
    ctlptr.maxlen = dlpi->maxlen - len;
    ctlptr.len = 0;
  }
  if (ret < 0) {
    ifstat_perror("getmsg");
    return 0;
  }
  len += ctlptr.len;
  
  err_ack = (dl_error_ack_t *) dlpi->buf;
  if (err_ack->dl_primitive != ackprim) {
    if (err_ack->dl_primitive == DL_ERROR_ACK) {
      errno = err_ack->dl_errno;
      ifstat_perror("dlpi");
    } else {
      ifstat_error("dlpi: unexpected ack type returned");
    }
    return 0;
  }

  if (ack != NULL)
    *ack = dlpi->buf;
  if (acklen != NULL)
    *acklen = len;
	
  return 1;
}
开发者ID:RaonControl,项目名称:siteApps,代码行数:57,代码来源:drivers.c


示例19: putControlMessage

/**
    Put a control message on a stream

    \param      fd - DLPI device file descriptor
    \param      len - length of control message
    \param      pri - message type
    \returns    0 if OK, -1 otherwise
*/
int dlpi::putControlMessage(int fd, int len, int pri)
{
    control.len = len;
    if (putmsg(fd, &control, 0, pri) < 0)
    {
        return ERROR;
    }
    return  0;
}
开发者ID:Microsoft,项目名称:pal,代码行数:17,代码来源:scxdlpi.cpp


示例20: pick_up

void pick_up(void){
    struct itemlist* i = get_square(player.x, player.y, player.ele)->i;
    if(!i){
        putmsg("There is nothing to pick up here.");
    }
    else {
        // TODO what would you like to pick up? blabla
    }
}
开发者ID:codl,项目名称:ponyrl,代码行数:9,代码来源:player.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ putnext函数代码示例发布时间:2022-05-30
下一篇:
C++ putimage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap