5 #define DEF 22 /* lines in chunk: 3*DEF == 66, #lines per nroff page */
15 main(int argc, char *argv[])
20 if((cons = Bopen("/dev/cons", OREAD)) == 0) {
21 fprint(2, "p: can't open /dev/cons\n");
22 exits("missing /dev/cons");
24 Binit(&bout, 1, OWRITE);
29 pglen = atoi(&argv[0][1]);
34 f = open(argv[0], OREAD);
36 fprint(2, "p: can't open %s - %r\n", argv[0]);
55 b = malloc(sizeof(Biobuf));
58 for(i=1; i <= pglen; i++) {
62 if(n > 0) /* line too long for Brdline */
64 Bputc(&bout, Bgetc(b));
70 Bwrite(&bout, s, Blinelen(b)-1);
72 Bwrite(&bout, "\n", 1);
77 cmd = Brdline(cons, '\n');
78 if(cmd == 0 || *cmd == 'q')
80 cmd[Blinelen(cons)-1] = 0;
83 dup(Bfildes(cons), 0);
84 execl("/bin/rc", "rc", "-c", cmd+1, nil);