mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +00:00
f1404aa948
It's now possible to do this in bash: cat kernel.map | fgrep List This is very cool! :^)
20 lines
400 B
C++
20 lines
400 B
C++
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
if (argc < 2) {
|
|
printf("usage: fgrep <str>\n");
|
|
return 0;
|
|
}
|
|
for (;;) {
|
|
char buf[4096];
|
|
fgets(buf, sizeof(buf), stdin);
|
|
if (strstr(buf, argv[1]))
|
|
write(1, buf, strlen(buf));
|
|
if (feof(stdin))
|
|
return 0;
|
|
}
|
|
return 0;
|
|
}
|