[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [BusyBox] Re: busybox-cvs Digest, Vol 7, Issue 19
From: Erik Andersen <andersen () codepoet ! org>
Date: 2003-10-31 10:17:56
[Download RAW message or body]
On Wed Oct 22, 2003 at 04:54:52PM +0400, Vladimir N. Oleynik wrote:
> Unfortunately, it is correct only for the vt console.
> For other terminals it can give wrong effect.
> I think, for busybox best is:
>
> #ifdef FEATURE_RESET_SUPPORT_INTERNACIONAL_MAPPING
> /* From <linux/kd.h> */
> static const int KDGKBTYPE = 0x4B33; /* get keyboard type */
> static const int KB_84 = 0x01;
> static const int KB_101 = 0x02; /* this is what we always answer */
>
> {
> char arg;
> int fd;
>
> for(fd = 0; fd < 3; fd++) {
> arg = 0;
> if(ioctl(fd, KDGKBTYPE, &arg) == 0)
> break;
> }
> if(fd < 3)
> printf("033(K");
> }
> #endif
>
>
> Also, I don`t know, all or not terminals clearing after "\033c". My
> consoles and xterms clearing all.
Can you test if this version works properly for you?
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"
extern int reset_main(int argc, char **argv)
{
if (isatty(0) || isatty(0) || isatty(0)) {
/* See 'man 4 console_codes' for details:
* "ESC c" -- Reset
* "ESC ( K" -- Select user mapping
* "ESC [ J" -- Erase display
* "ESC [ 0 m" -- Reset Graphics Rendition attributes
* "ESC [ ? 25 h" -- Make cursor visible.
*/
printf("\033c\033(K\033[J\033[0m\033[?25h");
}
return EXIT_SUCCESS;
}
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic