From 2f4c7860efd4dc8610574732a4f2ec2609dab326 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku
Date: Wed, 9 May 2018 14:41:48 -0700
Subject: [PATCH] doc: document that input pattern is a list.
Both the manual page and Info documentation now make it clear that the
pattern is actually a list of
This reproduces on grep 3.1 on Ubuntu.
The command:
grep -f -
should accept a list of patterns from standard input, like this:
$ grep -f -
pat1
pat2
pat3
[Ctrl-D]
Upon receiving the EOF indication (zero byte read), the program
should immediately conclude that the list of pat
Please allow me to add a semi-final comment to a closed bug.
Looking at grep's small body of code for handling the -f
option, I don't see anything substantially different between
3.1 and 3.7. It's the same logic wrapped around the fread
function.
Though the code has been worked on, there is no d
Nope! It looks like a behavior of fread.
We have to reverse the middle two arguments of fread,
so that it's reading an n-sized array of 1-byte objects,
rather than one object of size n.
#include
int main(void)
{
char buf[8192];
while (fread(buf, 1, sizeof buf, stdin) != 0);