Lines Matching refs:f
78 grep_refill(struct file *f) in grep_refill() argument
107 if (lseek(f->fd, 0, SEEK_SET) == -1) in grep_refill()
109 nr = read(f->fd, buffer, MAXBUFSIZ); in grep_refill()
117 nr = read(f->fd, buffer, MAXBUFSIZ); in grep_refill()
139 grep_fgetln(struct file *f, size_t *lenp) in grep_fgetln() argument
148 if (bufrem == 0 && grep_refill(f) != 0) in grep_fgetln()
175 if (grep_refill(f) != 0) in grep_fgetln()
202 grep_file_init(struct file *f) in grep_file_init() argument
207 (gzbufdesc = gzdopen(f->fd, "r")) == NULL) in grep_file_init()
211 (bzbufdesc = BZ2_bzdopen(f->fd, "r")) == NULL) in grep_file_init()
216 if (grep_refill(f) != 0) in grep_file_init()
222 f->binary = true; in grep_file_init()
224 return (f); in grep_file_init()
226 close(f->fd); in grep_file_init()
227 free(f); in grep_file_init()
237 struct file *f; in grep_open() local
239 f = grep_malloc(sizeof *f); in grep_open()
240 memset(f, 0, sizeof *f); in grep_open()
244 f->fd = STDIN_FILENO; in grep_open()
245 } else if ((f->fd = open(path, O_RDONLY)) == -1) { in grep_open()
246 free(f); in grep_open()
250 return (grep_file_init(f)); in grep_open()
257 grep_close(struct file *f) in grep_close() argument
260 close(f->fd); in grep_close()