diff --git a/man4/vcs.4 b/man4/vcs.4 index aebe8cfda..f695b956c 100644 --- a/man4/vcs.4 +++ b/man4/vcs.4 @@ -140,7 +140,8 @@ main(void) struct {unsigned char lines, cols, x, y;} scrn; unsigned short s; unsigned short mask; - unsigned char ch, attrib; + unsigned char attrib; + int ch; fd = open(console, O_RDWR); if (fd < 0) { @@ -158,16 +159,16 @@ main(void) exit(EXIT_FAILURE); } (void) read(fd, &scrn, 4); - (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0); + (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEK_SET); (void) read(fd, &s, 2); ch = s & 0xff; - if (attrib & mask) + if (s & mask) ch |= 0x100; attrib = ((s & ~mask) >> 8); - printf("ch=\(aq%c\(aq attrib=0x%02x\\n", ch, attrib); - attrib ^= 0x10; - (void) lseek(fd, \-1, 1); - (void) write(fd, &attrib, 1); + printf("ch=0x%03x attrib=0x%02x\\n", ch, attrib); + s ^= 0x1000; + (void) lseek(fd, \-2, SEEK_CUR); + (void) write(fd, &s, 2); exit(EXIT_SUCCESS); } .EE