⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getinput.c

📁 在x86平台上运行不可信任代码的sandbox。
💻 C
字号:
#include <assert.h>#include <unistd.h>#include <errno.h>#include "libvxc/private.h"#include "ioprivate.h"static char stdinbuf[BUFSIZ];FILE __stdin = {STDIN_FILENO};// Prefetch some input data if possible,// allocating a new input buffer if necessary.// Assumes the input buffer is currently empty.int __getinput(FILE *f){	if (f->ibuf == NULL) {		// No input buffer at all (yet).		// Give stdin a static buffer,		// so that we can read stdin without pulling in malloc.		if (f == stdin) {			stdin->ibuf = stdinbuf;			stdin->imax = BUFSIZ;		} else {			// File must not be open for writing.			errno = EBADF;			f->errflag = 1;			return EOF;		}	}	// Update offset.	f->ioffset += f->ilim;	f->ipos = 0;	f->ilim = 0;	// Read some input data	ssize_t rc = read(f->fd, f->ibuf, f->imax);	if (rc < 0) {		f->errflag = 1;		return EOF;	}	if (rc == 0) {		f->eofflag = 1;		return EOF;	}	f->ipos = 0;	f->ilim = rc;	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -