pipe-test

A simple program that pipes to less in C
git clone git://git.sgregoratto.me/pipe-test
Log | Files | Refs | README

commit 146f9f9a3800b714727c715580d2c4d0b94f70cf
parent 1a40e1af6901ce298fd535e83aab280c006e5b09
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date:   Wed, 30 Oct 2019 12:45:56 +1100

Change number formatting and start at 1

Diffstat:
Mpager.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pager.c b/pager.c @@ -62,6 +62,7 @@ main(int argc, char **argv) /* Make PIPE_READ of pipe pager's STDIN */ if (dup2(fildes[PIPE_READ], STDIN_FILENO) == -1) err(1, "dup2"); + #if HAVE_PLEDGE if (pledge("exec", NULL) == -1) err(1, "pledge"); @@ -80,8 +81,8 @@ main(int argc, char **argv) if (close(fildes[PIPE_READ]) == -1) err(1, "close"); - for (uint32_t i = 0; i <= lines; i++) - fprintf(fpipew, "%04d\n", i); + for (uint32_t i = 1; i <= lines; i++) + fprintf(fpipew, "%d\n", i); /* Flush the buffer and signal EOF to the pager process. */ if (fclose(fpipew) == EOF)