summaryrefslogtreecommitdiffstats
path: root/misc-utils/setterm.c
diff options
context:
space:
mode:
authorKarel Zak2007-10-11 12:45:53 +0200
committerKarel Zak2007-10-11 12:52:15 +0200
commitbc8572a27677688ec4c5040971140988c42af5fa (patch)
tree9f3de40d55da932621c2b4e3dda08c30e99b1bc6 /misc-utils/setterm.c
parentpo: update nl.po (from translationproject.org) (diff)
downloadkernel-qcow2-util-linux-bc8572a27677688ec4c5040971140988c42af5fa.tar.gz
kernel-qcow2-util-linux-bc8572a27677688ec4c5040971140988c42af5fa.tar.xz
kernel-qcow2-util-linux-bc8572a27677688ec4c5040971140988c42af5fa.zip
setterm: dump by TIOCLINUX is deprecated since linux 1.1.92.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/setterm.c')
-rw-r--r--misc-utils/setterm.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/misc-utils/setterm.c b/misc-utils/setterm.c
index 0a2f44c2d..5d889ea4f 100644
--- a/misc-utils/setterm.c
+++ b/misc-utils/setterm.c
@@ -1133,14 +1133,14 @@ screendump(int vcnum, FILE *F) {
}
if (fd < 0) {
sprintf(infile, "/dev/vcsa%d", vcnum);
- goto try_ioctl;
+ goto error;
}
if (read(fd, header, 4) != 4)
- goto try_ioctl;
+ goto error;
rows = header[0];
cols = header[1];
if (rows * cols == 0)
- goto try_ioctl;
+ goto error;
inbuf = malloc(rows*cols*2);
outbuf = malloc(rows*(cols+1));
if(!inbuf || !outbuf) {
@@ -1168,32 +1168,9 @@ screendump(int vcnum, FILE *F) {
}
return;
-try_ioctl:
- {
-#define NUM_COLS 160
-#define NUM_ROWS 75
- char buf[NUM_COLS+1];
- unsigned char screenbuf[NUM_ROWS*NUM_COLS];
- screenbuf[0] = 0;
- screenbuf[1] = (unsigned char) vcnum;
- if (ioctl(0,TIOCLINUX,screenbuf) < 0) {
- fprintf(stderr,_("couldn't read %s, and cannot ioctl dump\n"),
- infile);
- exit(1);
- }
- rows = screenbuf[0];
- cols = screenbuf[1];
-
- for (i=0; i<rows; i++) {
- strncpy(buf, screenbuf+2+(cols*i), cols);
- buf[cols] = '\0';
- j = cols;
- while (--j && (buf[j] == ' '))
- buf[j] = '\0';
- fputs(buf,F);
- fputc('\n',F);
- }
- }
+error:
+ fprintf(stderr, _("Couldn't read %s\n"), infile);
+ exit(1);
}
int