For comparison, the OpenBSD version: <a href="https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c">https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c</a><p>That’s a lot simpler, but also slower (see <a href="https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes_so_fast" rel="nofollow noreferrer">https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes...</a>, discussed in <a href="https://news.ycombinator.com/item?id=14542938">https://news.ycombinator.com/item?id=14542938</a>)