Exemple #1
0
//Pone un caracter en una zona de la pantalla
void putchar(char  c, int offset, int minioffset)
{
	int mitty;	
	char *video ;
	mitty=GetTTY();
	video=(char*)tty[mitty].terminal;
	video [160*offset+minioffset]= c;
}
Exemple #2
0
//Imprime un caracter en donde esta el cursor
void writechar(char c)
{
	int mitty;	
	char *video ;
	mitty=GetTTY();
	video=(char*)tty[mitty].terminal;
	video [tty[mitty].movimiento]= c;
	tty[mitty].movimiento+=2;
}
Exemple #3
0
//Imprime N blancos en una zona de la pantalla
void blank(int cant, int offset, int minioffset)
{
	int i;
	int mitty;
	char* pantalla=(char*)0xb8000;
	char *video ;
	mitty=GetTTY();
	video=(char*)tty[mitty].terminal;
	for(i=0;i<cant;i++)
		memcpy3(video + 160*offset+minioffset+2*i," ",1);
}
Exemple #4
0
//Imprime un mensaje en la consola de errores
void puterr(char* s)
{
	int mitty;	
	int len;
	char *video ;
	mitty=GetTTY();
	len=strlen2(s);
	video=(char*)tty[mitty].terminal;
	blank(70,24,0);
	message(s,24,0);
}
Exemple #5
0
//Imprime un mensaje en una zona de la pantalla
void message(char * mensaje, int offset, int minioffset)
{
	int longitud;
	int mitty;
	char* pantalla=(char*)0xb8000;
	char *video ;
	mitty=GetTTY();
	video=(char*)tty[mitty].terminal;
	longitud = strlen2(mensaje);
	memcpy3(video + 160*offset+minioffset, mensaje, longitud);
}
Exemple #6
0
//Imprime un mensaje donde esta el cursor
void mess(char* s)
{
	int mitty;	
	int len;
	char *video ;
	mitty=GetTTY();
	len=strlen2(s);
	video=(char*)tty[mitty].terminal;
	memcpy3(&video [tty[mitty].movimiento], s,len);
	tty[mitty].movimiento+=len*2;
}
Exemple #7
0
//Imprime un mensaje y un enter en donde esta el cursor
void messl(char* s)
{
	int mitty;	
	int len;
	char *video ;
	mitty=GetTTY();
	len=strlen2(s);
	video=(char*)tty[mitty].terminal;
	memcpy3(&video [tty[mitty].movimiento], s,len);
	tty[mitty].movimiento+=len*2;
	tty[mitty].movimiento=tty[mitty].movimiento-tty[mitty].movimiento%160+160;
	if (tty[mitty].movimiento / 160 >= 24)
	{
		Scroll();
	}
}
Exemple #8
0
//Scrollea la pantalla
void Scroll(void)
{
	int i;
	int mitty;	
	char *video ;
	mitty=GetTTY();
	video=(char*)tty[mitty].terminal;
	for(i = 160; i < (160 * 24); i++)
	{
		video[i - 160] = video[i];
	}
	for (i = (160 * 23); i < ((160 * 23) + 160); i += 2)
	{
		video[i] = ' ';
	}
	tty[mitty].movimiento = 160 * 23;
}
Exemple #9
0
//Limpia una TTY (aunque no este activa)
void k_clear_screen() 
{
	char *vidmem;
	int mitty=GetTTY();
	vidmem=(char*)tty[mitty].terminal;
	unsigned int i = 0;
	
	while(i < (80 * 24 * 2))
	{
		vidmem[i] = ' ';
		i++;
		vidmem[i] = WHITE_TXT;
		i++;
	};
	tty[mitty].movimiento=0;
	message("tty ",24,150);
	putchar((char)mitty+0x30,24,158);
	
}
Exemple #10
0
// Perform initial greeting dance with server over socket with supplied name.
// The procedure ends with "READY" and tty file descriptor are sent over the socket
// and "GO" being received in response, which means, that the server process has acquired
// file descriptor on the controlling terminal
static int Bootstrap(char *socket_name) {
    int tty, sock;

    tty = GetTTY(sock);

    if ((sock = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0)
            DieWithError("socket() failed");

    struct sockaddr_un echoServAddr;

    memset(&echoServAddr, 0, sizeof(echoServAddr));

    echoServAddr.sun_family = AF_LOCAL;

    strncpy(echoServAddr.sun_path + 1, socket_name, sizeof(echoServAddr.sun_path) - 2);

    int size = sizeof(echoServAddr) - sizeof(echoServAddr.sun_path) + strlen(echoServAddr.sun_path+1) + 1;

    if (connect(sock, (struct sockaddr *) &echoServAddr, size) < 0)
        DieWithError("connect() failed");

    dup2(sock, 1);
    dup2(sock, 2);

    if (ancil_send_fds_with_buffer(sock, tty))
        DieWithError("sending tty descriptor failed");

    if (scanf("GO") == 0) {
        if (close(tty))
            DieWithError("failed to close controlling tty");

        __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "The controlling tty is closed");
    } else
        DieWithError("incomplete confirmation message");

    return sock;
}