On Fri, Sep 16, 2016 at 11:43:37AM -0400, Greg Reagle wrote: > On Fri, Sep 16, 2016, at 10:01 AM, Greg Reagle wrote: > > Greetings. I am running stali in qemu and and it seems to lack a pager. > > Is it a goal of the suckless project to write a suckless pager for > > sbase? I see that plan9port already has a pager called "p". What about > > importing that into 9base? > > Since I know that code is king around here, I wrote a pager program. I > am not an expert C programmer, so I might have done some things wrong. > But I think it does a good job of being minimalist. > > What do you think? Would you like to put it into sbase or stali? If yes > then I can clone the sbase repo and submit a proper git patch. > > #include <errno.h> > #include <stdio.h> > > int main() > { > const int page_size = 22; > int count = 0; > int ch; > FILE *tty; > > if ((tty = fopen("/dev/tty", "a+")) == NULL) > return(errno); > > ch = getchar(); > while (ch != EOF) { > putchar(ch); > if (ch == '\n') { > ++count; > if (count >= page_size) { > fgetc(tty); > count = 0; > } > } > ch = getchar(); > } > fclose(tty); > }
hm, do you really need errno ?