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


C++ ARGF函数代码示例

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


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

示例1: main

int
main(int argc, char *argv[]) {
	prog = argv[0];

	fps_flag = (getenv("FPS") != NULL);

	load_config("lsc");
	init_font_locale(lookup("locale", 0, 0));
	srandom(0);
	set_screen_size(SCREEN_WIDTH, SCREEN_HEIGHT);
	layout_screen();
	init_polar();
	init_transforms();
	init_video_in();
	init_display(argc, argv, prog);
	set_category(primary_buttons[Cat_change_color].b);
	gettimeofday(&last_busy, 0);

	ARGBEGIN {
	case 'd':	debug++;			break;
	case 'g':	grabtimeout = atoi(ARGF());	break;
	case 'i':	idletime = atoi(ARGF());	break;
	default:
		return usage();
	} ARGEND;

	if (grabtimeout != 0 && grabtimeout < ALARMTIME) {
		fprintf(stderr, "unreasonable grab time limit\n");
		exit(14);
	}

	state = Live;
	io_main_loop();
	return 0;
}
开发者ID:wcheswick,项目名称:ex,代码行数:35,代码来源:lsc.c

示例2: main

void
main(int argc, char *argv[])
{
	char *p;
	int c;

	thechar = '5';
	thestring = "arm";

	ensuresymb(NSYMB);
	memset(debug, 0, sizeof(debug));
	cinit();
	outfile = 0;
	setinclude(".");
	ARGBEGIN {
	default:
		c = ARGC();
		if(c >= 0 || c < sizeof(debug))
			debug[c] = 1;
		break;

	case 'o':
		outfile = ARGF();
		break;

	case 'D':
		p = ARGF();
		if(p) {
			if (nDlist%8 == 0) 
				Dlist = allocn(Dlist, nDlist*sizeof(char *), 
					8*sizeof(char *));
			Dlist[nDlist++] = p;
		}
		break;

	case 'I':
		p = ARGF();
		setinclude(p);
		break;
	case 't':
		thechar = 't';
		thestring = "thumb";
		break;
	} ARGEND
	if(*argv == 0) {
		print("usage: %ca [-options] file.s\n", thechar);
		errorexit();
	}
	if(argc > 1){
		print("can't assemble multiple files\n");
		errorexit();
	}
	if(assemble(argv[0]))
		errorexit();
	exits(0);
}
开发者ID:hfeeki,项目名称:go,代码行数:56,代码来源:lex.c

示例3: main

void
main(int argc, char **argv)
{
	int stdio;

	stdio = 0;
	ARGBEGIN{
	case 'D':
		++chatty9p;
		break;
	case 'v':
		++chatty;
		break;
	case 'f':
		deffile = ARGF();
		break;
	case 'g':
		gidfile(ARGF());
		break;
	case 'p':
		uidfile(ARGF());
		break;
	case 's':
		stdio = 1;
		break;
	case 'r':
		rdonly = 1;
		break;
	default:
		usage();
	}ARGEND

	if(argc == 0)
		srvfile = "ext2";
	else if(argc == 1)
		srvfile = argv[0];
	else
		usage();
	
	iobuf_init();
	/*notify(handler);*/

	if(!chatty){
		close(2);
		open("#c/cons", OWRITE);
	}
	if(stdio){
		srv(&ext2srv);
	}else{
		chat("%s %d: serving %s\n", argv0, getpid(), srvfile);
		postmountsrv(&ext2srv, srvfile, 0, 0);
	}
	exits(0);
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:54,代码来源:xfssrv.c

示例4: main

void
main(int argc, char *argv[])
{
	Biobuf bout;
	Memimage *i;
	int fd;
	char *err, *filename;
	ImageInfo II;

	ARGBEGIN{
	case 'c':
		II.comment = ARGF();
		if(II.comment == nil)
			usage();
		II.fields_set |= II_COMMENT;
		break;
	case 'g':
		II.gamma = atof(ARGF());
		if(II.gamma == 0.)
			usage();
		II.fields_set |= II_GAMMA;
		break;
	case 't':
		break;
	default:
		usage();
	}ARGEND

	if(Binit(&bout, 1, OWRITE) < 0)
		sysfatal("Binit failed: %r");
	memimageinit();

	if(argc == 0){
		fd = 0;
		filename = "<stdin>";
	}else{
		fd = open(argv[0], OREAD);
		if(fd < 0)
			sysfatal("can't open %s: %r", argv[0]);
		filename = argv[0];
	}

	i = readmemimage(fd);
	if(i == nil)
		sysfatal("can't readimage %s: %r", filename);
	close(fd);

	err = memwritepng(&bout, i, &II);
	freememimage(i);

	if(err != nil)
		fprint(2, "topng: %s\n", err);
	exits(err);
}
开发者ID:aahud,项目名称:harvey,代码行数:54,代码来源:topng.c

示例5: main

void
main(int argc, char*argv[])
{
	char *p;
	Place pl;
	int newbaud;

	newbaud = -1;
	pl = nowhere;
	ARGBEGIN {
	default:
		fprint(2, "usage: %s [-b baud] [-d device] [-l longitude latitude] [-n newbaud]\n", argv0);
		exits("usage");
	case 'D':
		debug++;
		break;
	case 'b':
		baud = strtol(ARGF(), nil, 0);
		break;
	case 'd':
		serial = ARGF();
		break;
	case 'l':
		p = ARGF();
		if(strtolatlon(p, &p, &pl) < 0)
			sysfatal("bad position");
		while(*p == ' ' || *p == '\t' || *p == '\n')
			p++;
		if(*p == '\0')
			p = ARGF();
		if (strtolatlon(p, &p, &pl) < 0)
			sysfatal("bad position");
		while(*p == ' ' || *p == '\t' || *p == '\n')
			p++;
		if(*p != '\0')
			sysfatal("trailing gunk in position");
		where = pl;
		break;
	case 'n':
		newbaud = strtol(ARGF(), nil, 0);
		break;
	} ARGEND

	if(newbaud < 0)
		newbaud = baud;

	fmtinstall('L', placeconv);
	print("Initializing GPS to %d baud, at %L, time %s\n",
		newbaud, where, ctime(time(nil)));
	setline();
	evermore80(where, newbaud);
}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:52,代码来源:gpsevermore.c

示例6: main

void
main(int argc, char *av[])
{
	int i;
	char *f;

	argv = av;
	Binit(&bout, 1, OWRITE);
	ARGBEGIN{
	case 'w':
		wordflag = YES;
		break;
	case '_':
		wordflag = YES;
		underscoreflag = YES;
		break;
	case 'm':
		msflag = YES;
		if(f = ARGF())
			switch(*f)
			{
			case 'm':	mac = MM; break;
			case 's':	mac = MS; break;
			case 'l':	disp = 1; break;
			default:	usage();
			}
		else
			usage();
		break;
	case 'i':
		iflag = YES;
		break;
	default:
		usage();
	}ARGEND
	if(*argv)
		infile = opn(*argv++);
	else{
		infile = malloc(sizeof(Biobuf));
		Binit(infile, 0, OREAD);
	}
	files[0] = infile;
	filesp = &files[0];

	for(i='a'; i<='z' ; ++i)
		chars[i] = LETTER;
	for(i='A'; i<='Z'; ++i)
		chars[i] = LETTER;
	for(i='0'; i<='9'; ++i)
		chars[i] = DIGIT;
	chars['\''] = APOS;
	chars['&'] = APOS;
	chars['\b'] = APOS;
	chars['.'] = PUNCT;
	chars[','] = PUNCT;
	chars[';'] = PUNCT;
	chars['?'] = PUNCT;
	chars[':'] = PUNCT;
	work();
}
开发者ID:n-t-roff,项目名称:Plan9_troff,代码行数:60,代码来源:deroff.c

示例7: main

void
main(int argc, char **argv)
{
	int len;
	uchar *cert;
	ulong valid[2];
	RSApriv *key;

	fmtinstall('B', mpfmt);
	fmtinstall('H', encodefmt);

	valid[0] = time(0);
	valid[1] = valid[0] + 3*366*24*60*60;

	ARGBEGIN{
	default:
		usage();
	case 'e':
		valid[1] = valid[0] + strtoul(ARGF(), 0, 10);
		break;
	}ARGEND

	if(argc != 1 && argc != 2)
		usage();

	if((key = getkey(argc-1, argv+1, 1, nil)) == nil)
		sysfatal("%r");

	cert = X509gen(key, argv[0], valid, &len);
	if(cert == nil)
		sysfatal("X509gen: %r");

	write(1, cert, len);
	exits(0);
}
开发者ID:srk-cmu,项目名称:9problems,代码行数:35,代码来源:rsa2x509.c

示例8: xread

static int
xread(int argc, char *argv[]) {
	IxpCFid *fid;
	char *file, *buf;
	int count;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	if(argc == 0)
		usage();
	file = EARGF(usage());
	do {
		fid = ixp_open(client, file, P9_OREAD);
		if(fid == nil)
			fatal("Can't open file '%s': %r\n", file);

		buf = emalloc(fid->iounit);
		while((count = ixp_read(fid, buf, fid->iounit)) > 0)
			write(1, buf, count);
		ixp_close(fid);

		if(count == -1)
			fprint(2, "%s: cannot read file '%s': %r\n", argv0, file);
	} while((file = ARGF()));

	return 0;
}
开发者ID:bartman,项目名称:wmii,代码行数:30,代码来源:wmiir.c

示例9: xawrite

static int
xawrite(int argc, char *argv[]) {
	IxpCFid *fid;
	char *file, *buf;
	int nbuf, i;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	file = EARGF(usage());
	fid = ixp_open(client, file, P9_OWRITE);
	if(fid == nil)
		fatal("Can't open file '%s': %r\n", file);

	nbuf = 1;
	for(i=0; i < argc; i++)
		nbuf += strlen(argv[i]) + (i > 0);
	buf = emalloc(nbuf);
	buf[0] = '\0';
	while(argc) {
		strcat(buf, ARGF());
		if(argc)
			strcat(buf, " ");
	}

	if(ixp_write(fid, buf, nbuf) == -1)
		fatal("cannot write file '%s': %r\n", file);
	ixp_close(fid);
	free(buf);
	return 0;
}
开发者ID:bartman,项目名称:wmii,代码行数:33,代码来源:wmiir.c

示例10: threadmain

void
threadmain(int argc, char *argv[])
{
	uint32_t bcmem;

	bcmem = 0;

	ARGBEGIN{
	case 'B':
		bcmem = unittoull(ARGF());
		break;
	default:
		usage();
		break;
	}ARGEND

	readonly = 1;

	if(argc != 1)
		usage();

	if(initventi(argv[0], &conf) < 0)
		sysfatal("can't init venti: %r");

	if(bcmem < maxblocksize * (mainindex->narenas + mainindex->nsects * 4 + 16))
		bcmem = maxblocksize * (mainindex->narenas + mainindex->nsects * 4 + 16);
	if(0) fprint(2, "initialize %d bytes of disk block cache\n", bcmem);
	initdcache(bcmem);

	clumpstats(mainindex);
	
	threadexitsall(0);
}
开发者ID:aahud,项目名称:harvey,代码行数:33,代码来源:clumpstats.c

示例11: main

void
main(int argc, char **argv)
{
	Ndb *db;
	char *dbfile = 0;

	ARGBEGIN{
	case 'f':
		dbfile = ARGF();
		break;
	default:
		usage();
		break;
	}ARGEND;

	if(argc < 3)
		usage();

	db = ndbopen(dbfile);
	if(db == 0){
		fprint(2, "no db files\n");
		exits("no db");
	}
	search(db, argv[0], argv[1], argv+2, argc-2);
	ndbclose(db);

	exits(0);
}
开发者ID:99years,项目名称:plan9,代码行数:28,代码来源:ipquery.c

示例12: main

int
main(int argc, char *argv[]) {
	char *s;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	setlocale(LC_CTYPE, "");

	initdisplay();

	s = ARGF();
	if(s && !getulong(s, &win.w))
		usage();
	if (!s)
		win.w = getfocus();

	if(argc)
		usage();

	click(&win, Pt(1, 1));

	XCloseDisplay(display);
	return 0;
}
开发者ID:bartman,项目名称:wmii,代码行数:27,代码来源:main.c

示例13: main

void
main(int argc, char *argv[])
{
	Modem *m;

	m = &modems[0];

	ARGBEGIN{
	case 'v':
		vflag = 1;
		break;

	case 's':
		spool = ARGF();
		break;

	default:
		usage();
		break;

	}ARGEND

	initmodem(m, 0, -1, type, 0);
	receivedone(m, faxreceive(m, spool));

	exits(0);
}
开发者ID:aahud,项目名称:harvey,代码行数:27,代码来源:receive.c

示例14: threadmain

void
threadmain(int argc, char *argv[])
{
	u32int bcmem;
	int fix;

	fix = 0;
	bcmem = 0;
	ARGBEGIN{
	case 'B':
		bcmem = unittoull(ARGF());
		break;
	default:
		usage();
		break;
	}ARGEND

	if(!fix)
		readonly = 1;

	if(argc != 1)
		usage();

	if(initventi(argv[0], &conf) < 0)
		sysfatal("can't init venti: %r");

	printindex(1, mainindex);
	threadexitsall(0);
}
开发者ID:npe9,项目名称:harvey,代码行数:29,代码来源:printmap.c

示例15: main

void
main(int argc, char *argv[])
{
	VtSession *z;
	int i, j, t;
	int start;
	uchar buf[BlockSize];

	srand(time(0));

	ARGBEGIN{
	case 'r':
		rflag++;
		break;
	case 'n':
		nblock = atoi(ARGF());
		break;
	}ARGEND

	for(i=0; i<nblock; i++)
		perm[i] = i;

	if(rflag) {
		for(i=0; i<nblock; i++) {
			j = nrand(nblock);
			t = perm[j];
			perm[j] = perm[i];
			perm[i] = t;
		}
	}

	if(readn(0, data, VtScoreSize*nblock) < VtScoreSize*nblock)
		sysfatal("read failed: %r");

	vtAttach();

	z = vtDial("iolaire2");
	if(z == nil)
		sysfatal("cound not connect to venti");
	if(!vtConnect(z, 0))
		vtFatal("vtConnect: %s", vtGetError());

	print("starting\n");

	start = times(0);

	if(rflag && nblock > 10000)
		nblock = 10000;

	for(i=0; i<nblock; i++) {
		if(vtRead(z, data+perm[i]*VtScoreSize, VtDataType, buf, BlockSize) < 0)
			vtFatal("vtRead failed: %d: %s", i, vtGetError());
	}

	print("time = %f\n", (times(0) - start)*0.001);

	vtClose(z);
	vtDetach();
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:59,代码来源:rtest.c


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