#include <unistd.h>
int main() {
int fd[2];
pipe(fd);
close(0);
dup(fd[0]);
fork() || execl("/usr/bin/less", "", 0);
write(fd[1], "hoge\nfuga\npiyo\n", 15);
return 0;
}
I2luY2x1ZGUgPHVuaXN0ZC5oPgppbnQgbWFpbigpIHsKICBpbnQgZmRbMl07CiAgcGlwZShmZCk7CiAgY2xvc2UoMCk7CiAgZHVwKGZkWzBdKTsKICBmb3JrKCkgfHwgZXhlY2woIi91c3IvYmluL2xlc3MiLCAiIiwgMCk7CiAgd3JpdGUoZmRbMV0sICJob2dlXG5mdWdhXG5waXlvXG4iLCAxNSk7CiAgcmV0dXJuIDA7Cn0=