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");
25 Binit(&bout, 1, OWRITE);
31 pglen = atoi(&argv[0][1]);
36 f = open(argv[0], OREAD);
38 fprint(2, "p: can't open %s - %r\n", argv[0]);
57 b = malloc(sizeof(Biobuf));
61 for(i=1; i <= pglen; i++) {
65 if(n > 0) /* line too long for Brdline */
67 Bputc(&bout, Bgetc(b));
73 Bwrite(&bout, s, Blinelen(b)-1);
75 Bwrite(&bout, "\n", 1);
80 cmd = Brdline(cons, '\n');
81 if(cmd == 0 || *cmd == 'q')
83 cmd[Blinelen(cons)-1] = 0;
86 dup(Bfildes(cons), 0);
87 execl("/bin/rc", "rc", "-c", cmd+1, nil);