From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,FH_DATE_PAST_20XX autolearn=no version=3.2.5 From: Michael Schutte To: kbd@lists.altlinux.org Date: Sat, 2 Jan 2010 17:34:41 +0100 Message-Id: <1262450081-7229-2-git-send-email-michi@uiae.at> X-Mailer: git-send-email 1.6.5 Subject: [kbd] [PATCH] vcstime: Use either /dev/vcs[a] or /dev/vcs[a]0 X-BeenThere: kbd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Linux console tools development discussion List-Id: Linux console tools development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 16:35:01 -0000 Archived-At: List-Archive: Make vcstime work on all systems by considering both /dev/vcs and /dev/vcs0 to hold the console memory for the current VT. Signed-off-by: Michael Schutte --- contrib/vcstime.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/vcstime.c b/contrib/vcstime.c index 0e657c0..1ee8edd 100644 --- a/contrib/vcstime.c +++ b/contrib/vcstime.c @@ -20,10 +20,11 @@ number_of_columns() { int fda; unsigned char rc[2]; /* unsigned: Ranty@soon.com */ - if((fda = open("/dev/vcsa0", O_RDONLY)) < 0) - fatal("/dev/vcsa0"); + if((fda = open("/dev/vcsa", O_RDONLY)) < 0 + && (fda = open("/dev/vcsa0", O_RDONLY)) < 0) + fatal("/dev/vcsa"); if(read(fda, rc, 2) != 2) - fatal("/dev/vcsa0"); + fatal("/dev/vcsa"); close(fda); return rc[1]; } @@ -36,8 +37,9 @@ main(){ struct tm *t; char tijd[10]; - if((fd = open("/dev/vcs0", O_WRONLY)) < 0) - fatal("/dev/vcs0"); + if((fd = open("/dev/vcs", O_WRONLY)) < 0 + && (fd = open("/dev/vcs0", O_WRONLY)) < 0) + fatal("/dev/vcs"); while(1) { lseek(fd, cols-10, 0); -- tg: (dab334b..) fixes/vcstime (depends on: upstream/master)