Package: manpages
Version: 2.67-1
Severity: normal
Tags: patch
Hello,
Here is a documentation fix for vcsa(4): attribute/text characters are
in the host endianness. Also, document the VT_GETHIFONTMASK ioctl.
Samuel
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1,
'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.23
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash
-- no debconf information
--
Samuel
* D a decide de peter un cable dans son rapport de pfp
<c> et il a bien raison ;-)
<c> tu vas dire quoi ?
<D> j'ai mis les paroles de "le coq est mort" en en-tete
-+- #ens-mim et la peufeupeu -+-
--- vcsa.4.orig 2007-12-15 17:31:48.000000000 +0000
+++ vcsa.4 2007-12-15 18:05:21.000000000 +0000
@@ -36,9 +36,13 @@
terminals, they have major number 7 and minor number 1 to 63, usually
mode 0644 and owner root.tty.
\fI/dev/vcsa[0\-63]\fP are the same, but
-including attributes, and prefixed with four bytes giving the screen
+using unsigned shorts (in host byte endianity) that include attributes, and
+prefixed with four bytes giving the screen
dimensions and cursor position: \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP.
-(\fIx\fP = \fIy\fP = 0 at the top left corner of the screen.)
+(\fIx\fP = \fIy\fP = 0 at the top left corner of the screen.) When a 512
+character font is loaded, the 9th bit position can be fetched thanks to calling
+the \fIVT_GETHIFONTMASK\fP ioctl on \fI/dev/tty[1\-63]\fP (available in Linux
+kernels 2.6.18 and above).
.PP
These replace the screendump
.IR ioctl s
@@ -87,15 +91,30 @@
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/vt.h>
int
main(void)
{
int fd;
char *device = "/dev/vcsa2";
+ char *console = "/dev/tty2";
struct {unsigned char lines, cols, x, y;} scrn;
- char ch, attrib;
+ unsigned short s;
+ unsigned short mask;
+ unsigned char ch, attrib;
+ fd = open(console, O_RDWR);
+ if (fd < 0) {
+ perror(console);
+ exit(EXIT_FAILURE);
+ }
+ if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
+ perror("VT_GETHIFONTMASK");
+ exit(EXIT_FAILURE);
+ }
+ (void) close(fd);
fd = open(device, O_RDWR);
if (fd < 0) {
perror(device);
@@ -103,8 +122,11 @@
}
(void) read(fd, &scrn, 4);
(void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
- (void) read(fd, &ch, 1);
- (void) read(fd, &attrib, 1);
+ (void) read(fd, &s, 2);
+ ch = s & 0xff;
+ if (attrib & mask)
+ ch |= 0x100;
+ attrib = ((s & ~mask) >> 8);
printf("ch='%c' attrib=0x%02x\\n", ch, attrib);
attrib ^= 0x10;
(void) lseek(fd, \-1, 1);