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

C++ seprint函数代码示例

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

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



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

示例1: _attrfmt

int
_attrfmt(Fmt *fmt)
{
    char *b, buf[1024], *ebuf;
    Attr *a;

    ebuf = buf+sizeof buf;
    b = buf;
    strcpy(buf, " ");
    for(a=va_arg(fmt->args, Attr*); a; a=a->next) {
        if(a->name == nil)
            continue;
        switch(a->type) {
        case AttrQuery:
            b = seprint(b, ebuf, " %q?", a->name);
            break;
        case AttrNameval:
            b = seprint(b, ebuf, " %q=%q", a->name, a->val);
            break;
        case AttrDefault:
            b = seprint(b, ebuf, " %q:=%q", a->name, a->val);
            break;
        }
    }
    return fmtstrcpy(fmt, buf+1);
}
开发者ID:JehanneOS,项目名称:devtools-drawterm,代码行数:26,代码来源:attr.c


示例2: ctlread

static void
ctlread(Req* r)
{
	char	buf[4096];
	char*	s;
	int	i;

	s = seprint(buf, buf+sizeof(buf), "trie %s\n", tfname);
	s = seprint(s, buf+sizeof(buf), "prefixes %ld\n", ntries);
	s = seprint(s, buf+sizeof(buf), "tags %ld\n", nvaltries);
	s = seprint(s, buf+sizeof(buf), "max entry %ld\n", maxvals);
	if(trie->nents > 0){
		s = seprint(s, buf+sizeof(buf), "%d root runes [", trie->nents);
		for(i = 0; i < trie->nents; i++)
			s = seprint(s, buf+sizeof(buf), "%C", trie->ents[i].r);
		s = seprint(s, buf+sizeof(buf), "]\n");
	}
	if(roott.nents > 0){
		s = seprint(s, buf+sizeof(buf), "%d used runes [", roott.nents);
		for(i = 0; i < roott.nents; i++)
			s = seprint(s, buf+sizeof(buf), "%C", roott.ents[i].r);
		seprint(s, buf+sizeof(buf), "]\n");
	}
	readstr(r, buf);
	respond(r, nil);
}
开发者ID:ericvh,项目名称:tagfs,代码行数:26,代码来源:tagfs.c


示例3: dumpframe

void
dumpframe(char *tag, void *p, int n)
{
	Etherpkt *ep;
	char buf[128];
	char *s, *se;
	int i;

	ep = p;
	if(n < Eaddrlen * 2 + 2){
		fprint(2, "short packet (%d bytes)\n", n);
		return;
	}
	se = buf+sizeof(buf);
	s = seprint(buf, se, "%s [%d]: ", tag, n);
	s = seprintaddr(s, se, ep->s);
	s = seprint(s, se, " -> ");
	s = seprintaddr(s, se, ep->d);
	s = seprint(s, se, " type 0x%02ux%02ux ", ep->type[0], ep->type[1]);
	n -= Eaddrlen * 2 + 2;
	for(i = 0; i < n && i < 16; i++)
		s = seprint(s, se, "%02x", ep->data[i]);
	if(n >= 16)
		fprint(2, "%s...\n", buf);
	else
		fprint(2, "%s\n", buf);
}
开发者ID:npe9,项目名称:harvey,代码行数:27,代码来源:ether.c


示例4: printpkt

/*
 *  format and print a packet
 */
void
printpkt(char *p, char *e, uint8_t *ps, uint8_t *pe)
{
	Msg m;
	uint32_t dt;

	dt = (pkttime-starttime)/1000000LL;
	m.p = seprint(p, e, "%6.6lu ms ", dt);
	m.ps = ps;
	m.pe = pe;
	m.e = e;
	m.pr = root;
	while(m.p < m.e){
		if(!sflag)
			m.p = seprint(m.p, m.e, "\n\t");
		m.p = seprint(m.p, m.e, "%s(", m.pr->name);
		if((*m.pr->seprint)(&m) < 0){
			m.p = seprint(m.p, m.e, "TOO SHORT");
			m.ps = m.pe;
		}
		m.p = seprint(m.p, m.e, ")");
		if(m.pr == nil || m.ps >= m.pe)
			break;
	}
	*m.p++ = '\n';

	if(write(1, p, m.p - p) < 0)
		sysfatal("stdout: %r");
}
开发者ID:aahud,项目名称:harvey,代码行数:32,代码来源:main.c


示例5: writeinfo

static void
writeinfo(Dev *d)
{
	char buf[128];
	char *s;
	char *se;
	Usbdev *ud;
	Conf *c;
	Iface *ifc;
	int i, j;

	ud = d->usb;
	s = buf;
	se = buf+sizeof(buf);
	s = seprint(s, se, "info %s csp %#08ux", classname(ud->class), ud->csp);
	for(i = 0; i < ud->nconf; i++){
		c = ud->conf[i];
		if(c == nil)
			break;
		for(j = 0; j < nelem(c->iface); j++){
			ifc = c->iface[j];
			if(ifc == nil)
				break;
			if(ifc->csp != ud->csp)
				s = seprint(s, se, " csp %#08ulx", ifc->csp);
		}
	}
	s = seprint(s, se, " vid %06#x did %06#x", ud->vid, ud->did);
	seprint(s, se, " %q %q", ud->vendor, ud->product);
	devctl(d, "%s", buf);
}
开发者ID:dancrossnyc,项目名称:harvey,代码行数:31,代码来源:dev.c


示例6: confine

char *
confine(char *q, char *s)
{
	int i, n, m;
	char *p, *e, *r, *buf, *toks[Maxtoks];

	n = nhgetl(q);
	q += 4;
	buf = malloc(n+1);
	if (buf == nil)
		return nil;
	memmove(buf, q, n);
	buf[n]  = 0;
	m = tokenize(buf, toks, nelem(toks));
	e = s + n + 1;
	for (i = 0, r = s; i < m; ++i) {
		p = strrchr(toks[i], '/');
		if (p == nil)
			r = seprint(r, e, "%s ", toks[i]);
		else if (p[0] != '\0' && p[1] != '\0')
			r = seprint(r, e, "%s ", p+1);
		else
			r = seprint(r, e, ". ");
	}
	free(buf);
	q += n;
	return q;
}
开发者ID:99years,项目名称:plan9,代码行数:28,代码来源:sshsession.c


示例7: p_seprintcomp

static int
p_seprintcomp(Msg *m)
{
	char compflag[5];
	ushort x;
	int i;
	int len;

	len = m->pe-m->ps;
	if(len < 2)
		return -1;

	x = NetS(m->ps);
	m->ps += 2;
	i = 0;
	if(x & (1<<15))
		compflag[i++] = 'r';
	if(x & (1<<14))
		compflag[i++] = 'f';
	if(x & (1<<13))
		compflag[i++] = 'c';
	if(x & (1<<12))
		compflag[i++] = 'e';
	compflag[i] = 0;
	m->p = seprint(m->p, m->e, "flag=%s count=%.3ux", compflag, x&0xfff);
	m->p = seprint(m->p, m->e, " data=%.*H", len>64?64:len, m->ps);
	m->pr = nil;
	return 0;
}
开发者ID:99years,项目名称:plan9,代码行数:29,代码来源:ppp.c


示例8: seprintccpopt

static char*
seprintccpopt(char *p, char *e, void *a, int len)
{
	Lcpopt *o;
	uchar *cp, *ecp;

	cp = a;
	ecp = cp+len;

	for(; cp < ecp; cp += o->len){
		o = (Lcpopt*)cp;
		if(cp + o->len > ecp){
			p = seprint(p, e, " bad opt len %ux", o->type);
			return p;
		}
		
		switch(o->type){
		default:
			p = seprint(p, e, " type=%d ", o->type);
			break;
		case 0:
			p = seprint(p, e, " OUI=(%d %.2ux%.2ux%.2ux) ", o->type, 
				o->data[0], o->data[1], o->data[2]);
			break;
		case 17:
			p = seprint(p, e, " Stac-LZS");
			break;
		case 18:
			p = seprint(p, e, " Microsoft-PPC=%ux", NetL(o->data));
			break;
		}
	}
	return p;
}
开发者ID:99years,项目名称:plan9,代码行数:34,代码来源:ppp.c


示例9: p_seprint

static int
p_seprint(Msg *m)
{
	Hdr *h;
	uint32_t x;

	h = (Hdr*)m->ps;

	if(m->pe < (uint8_t*)h->sname)
		return -1;

	/* point past data */
	m->ps = h->optdata;

	/* next protocol */
	m->pr = nil;
	if(m->pe >= (uint8_t*)h->optdata){
		x = NetL(h->optmagic);
		demux(p_mux, x, x, m, &dump);
	}

	m->p = seprint(m->p, m->e, "t=%s ht=%d hl=%d hp=%d xid=%x sec=%d fl=%4.4x ca=%V ya=%V sa=%V ga=%V cha=%E magic=%lx",
		op(h->op), h->htype, h->hlen, h->hops,
		NetL(h->xid), NetS(h->secs), NetS(h->flags),
		h->ciaddr, h->yiaddr, h->siaddr, h->giaddr, h->chaddr,
		(uint32_t)NetL(h->optmagic));
	if(m->pe > (uint8_t*)h->sname && *h->sname)
		m->p = seprint(m->p, m->e, " snam=%s", h->sname);
	if(m->pe > (uint8_t*)h->file && *h->file)
		m->p = seprint(m->p, m->e, " file=%s", h->file);
	return 0;
}
开发者ID:aahud,项目名称:harvey,代码行数:32,代码来源:bootp.c


示例10: seprintconf

static char*
seprintconf(char *s, char *e, Usbdev *d, int ci)
{
	int i;
	Conf *c;
	char *hd;

	c = d->conf[ci];
	s = seprint(s, e, "\tconf: cval %d attrib %x %d mA\n",
		c->cval, c->attrib, c->milliamps);
	for(i = 0; i < Niface; i++)
		if(c->iface[i] == nil)
			break;
		else
			s = seprintiface(s, e, c->iface[i]);
	for(i = 0; i < Nddesc; i++)
		if(d->ddesc[i] == nil)
			break;
		else if(d->ddesc[i]->conf == c){
			hd = hexstr((uint8_t*)&d->ddesc[i]->data,
				d->ddesc[i]->data.bLength);
			s = seprint(s, e, "\t\tdev desc %x[%d]: %s\n",
				d->ddesc[i]->data.bDescriptorType,
				d->ddesc[i]->data.bLength, hd);
			free(hd);
		}
	return s;
}
开发者ID:bhanug,项目名称:harvey,代码行数:28,代码来源:dump.c


示例11: Ufmt

int
Ufmt(Fmt *f)
{
	int i;
	Dev *d;
	Usbdev *ud;
	char buf[1024];
	char *s, *e;

	s = buf;
	e = buf+sizeof(buf);
	d = va_arg(f->args, Dev*);
	if(d == nil)
		return fmtprint(f, "<nildev>\n");
	s = seprint(s, e, "%s", d->dir);
	ud = d->usb;
	if(ud == nil)
		return fmtprint(f, "%s %ld refs\n", buf, d->Ref.ref);
	s = seprint(s, e, " csp %s.%uld.%uld",
		classname(Class(ud->csp)), Subclass(ud->csp), Proto(ud->csp));
	s = seprint(s, e, " vid %#ux did %#ux", ud->vid, ud->did);
	s = seprint(s, e, " refs %ld\n", d->Ref.ref);
	s = seprint(s, e, "\t%s %s %s\n", ud->vendor, ud->product, ud->serial);
	for(i = 0; i < Nconf; i++){
		if(ud->conf[i] == nil)
			break;
		else
			s = seprintconf(s, e, ud, i);
	}
	return fmtprint(f, "%s", buf);
}
开发者ID:bhanug,项目名称:harvey,代码行数:31,代码来源:dump.c


示例12: flashread

static long	 
flashread(Chan *c, void *buf, long n, vlong offset)
{
	Flash *f;
	char *s, *o;
	Flashpart *fp;
	Flashregion *r;
	int i;
	ulong start, end;

	if(c->qid.type & QTDIR)
		return devdirread(c, buf, n, nil, 0, flashgen);

	f = flash.card[c->dev];
	fp = &f->part[PART(c->qid.path)];
	if(fp->name == nil)
		error(Egreg);
	switch(TYPE(c->qid.path)){
	case Qdata:
		offset += fp->start;
		if(offset >= fp->end)
			return 0;
		if(offset+n > fp->end)
			n = fp->end - offset;
		n = readflash(f, buf, offset, n);
		if(n < 0)
			error(Eio);
		return n;
	case Qctl:
		s = malloc(READSTR);
		if(waserror()){
			free(s);
			nexterror();
		}
		o = seprint(s, s+READSTR, "%#2.2ux %#4.4ux %d %q\n",
			f->id, f->devid, f->width, f->sort!=nil? f->sort: "nor");
		for(i=0; i<f->nr; i++){
			r = &f->regions[i];
			if(r->start < fp->end && fp->start < r->end){
				start = r->start;
				if(fp->start > start)
					start = fp->start;
				end = r->end;
				if(fp->end < end)
					end = fp->end;
				o = seprint(o, s+READSTR, "%#8.8lux %#8.8lux %#8.8lux", start, end, r->erasesize);
				if(r->pagesize)
					o = seprint(o, s+READSTR, " %#8.8lux", r->pagesize);
				o = seprint(o, s+READSTR, "\n");
			}
		}
		n = readstr(offset, buf, n, s);
		poperror();
		free(s);
		return n;
	}
	error(Egreg);
	return 0;		/* not reached */
}
开发者ID:8l,项目名称:inferno,代码行数:59,代码来源:devflash.c


示例13: csipinfo

/*
 *  look up the ip attributes 'list' for an entry that has the
 *  given 'attr=val' and a 'ip=' tuples.
 *
 *  return nil if not found.
 */
Ndbtuple*
csipinfo(char *netroot, char *attr, char *val, char **list, int n)
{
	Ndbtuple *t, *first, *last;
	int i;
	char line[1024];
	int fd;
	char *p, *e;

	if(netroot)
		snprint(line, sizeof(line), "%s/cs", netroot);
	else
		strcpy(line, "/net/cs");
	fd = open(line, ORDWR);
	if(fd < 0)
		return 0;
	seek(fd, 0, 0);
	e = line + sizeof(line);
	p = seprint(line, e, "!ipinfo %s=%s", attr, val);
	for(i = 0; i < n; i++){
		if(*list == nil)
			break;
		p = seprint(p, e, " %s", *list++);
	}
	
	if(write(fd, line, strlen(line)) < 0){
		close(fd);
		return 0;
	}
	seek(fd, 0, 0);

	first = last = 0;
	for(;;){
		n = read(fd, line, sizeof(line)-2);
		if(n <= 0)
			break;
		line[n] = '\n';
		line[n+1] = 0;

		t = _ndbparseline(line);
		if(t == 0)
			continue;
		if(first)
			last->entry = t;
		else
			first = t;
		last = t;

		while(last->entry)
			last = last->entry;
	}
	close(fd);

	setmalloctag(first, getcallerpc(&netroot));
	return first;
}
开发者ID:00001,项目名称:plan9port,代码行数:62,代码来源:csipinfo.c


示例14: getplaystat

char *
getplaystat(char *p, char *e)
{
	p = seprint(p, e, "empty buffers %d of %d\n", empty->n, empty->s);
	p = seprint(p, e, "full buffers %d of %d\n", full->n, full->s);
	p = seprint(p, e, "playout buffers %d of %d\n", playout->n, playout->s);
	p = seprint(p, e, "spare buffers %d of %d\n", spare->n, spare->s);
	p = seprint(p, e, "bytes %lud / buffers %lud played\n", totbytes, totbuffers);
	return p;
}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:10,代码来源:player.c


示例15: pflag

static char *
pflag(char *s, char *e, uchar f)
{
	uchar i;

	for(i = 0; i < 8; i++)
		if(f & (1 << i))
			s = seprint(s, e, "%s ", flagname[i]);
	return seprint(s, e, "\n");
}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:10,代码来源:sdaoe.c


示例16: ptype

static char*
ptype(char *p, char *e, uint8_t val)
{
	char *x;

	x = dhcptype[val];
	if(x != nil)
		return seprint(p, e, "t=%s", x);
	else
		return seprint(p, e, "t=%d", val);
}
开发者ID:bhanug,项目名称:harvey,代码行数:11,代码来源:dhcp.c


示例17: printech2

static char *
printech2(EiceChain2 *ec2, char *s, int ssz)
{
	char *e, *te;

	te = s + ssz -1;
	
	e = seprint(s, te, "data: %#8.8ux\n", ec2->data);
	e = seprint(e, te, "addr: %#2.2ux\n", ec2->addr);
	e = seprint(e, te, "rw: %1.1d\n", ec2->rw);
	return e;
}
开发者ID:lufia,项目名称:plan9-contrib,代码行数:12,代码来源:icert.c


示例18: pserver

static char*
pserver(char *p, char *e, char *tag, uint8_t *o, int n)
{
	p = seprint(p, e, "%s=(", tag);
	while(n >= 4){
		p = seprint(p, e, " %V", o);
		n -= 4;
		o += 4;
	}
	p = seprint(p, e, ")");
	return p;
}
开发者ID:bhanug,项目名称:harvey,代码行数:12,代码来源:dhcp.c


示例19: p_seprint

static int
p_seprint(Msg *m)
{
	char *e;

	if((e = convM2DNS(m->ps, m->pe-m->ps, &dm, nil)) != nil){
		m->p = seprint(m->p, m->e, "error: %s", e);
		return 0;
	}
	m->p = seprint(m->p, m->e, "id=%d flags=%#ux", dm.id, dm.flags);
	donext(m);
	return 0;
}
开发者ID:npe9,项目名称:harvey,代码行数:13,代码来源:dns.c


示例20: printech1

static char *
printech1(EiceChain1 *ec1, char *s, int ssz)
{
	char *e, *te;

	te = s + ssz -1;
	
	e = seprint(s, te, "rwdata: %#8.8ux\n", ec1->rwdata);
	e = seprint(e, te, "wptandbkpt: %1.1d\n", ec1->wptandbkpt);
	e = seprint(e, te, "sysspeed: %1.1d\n", ec1->sysspeed);
	e = seprint(e, te, "instr: %#8.8ux\n", ec1->instr);
	return e;
}
开发者ID:lufia,项目名称:plan9-contrib,代码行数:13,代码来源:icert.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ seprintf函数代码示例发布时间:2022-05-30
下一篇:
C++ separator函数代码示例发布时间: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