當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。