示例#1
0
文件: prompt.c 项目: h4ck3rm1k3/toxic
static void prompt_onInit(ToxWindow *self, Tox *m)
{
    curs_set(1);
    int y2, x2;
    getmaxyx(self->window, y2, x2);

    ChatContext *ctx = self->chatwin;
    ctx->history = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
    ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);

    ctx->log = calloc(1, sizeof(struct chatlog));
    ctx->hst = calloc(1, sizeof(struct history));

    if (ctx->log == NULL || ctx->hst == NULL)
        exit_toxic_err("failed in prompt_onInit", FATALERR_MEMORY);

    line_info_init(ctx->hst);

    if (user_settings->autolog == AUTOLOG_ON) {
        uint8_t myid[TOX_FRIEND_ADDRESS_SIZE];
        tox_get_address(m, myid);
        log_enable(self->name, myid, ctx->log);
    }

    scrollok(ctx->history, 0);
    wmove(self->window, y2 - CURS_Y_OFFSET, 0);

    print_welcome_msg(self);
}
示例#2
0
文件: prompt.c 项目: SmoothDude/toxic
static void prompt_onInit(ToxWindow *self, Tox *m)
{
    curs_set(1);
    int y2, x2;
    getmaxyx(self->window, y2, x2);

    ChatContext *ctx = self->chatwin;
    ctx->history = subwin(self->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
    ctx->linewin = subwin(self->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);

    ctx->log = calloc(1, sizeof(struct chatlog));
    ctx->hst = calloc(1, sizeof(struct history));

    if (ctx->log == NULL || ctx->hst == NULL)
        exit_toxic_err("failed in prompt_onInit", FATALERR_MEMORY);

    line_info_init(ctx->hst);

    if (user_settings->autolog == AUTOLOG_ON) {
        char myid[TOX_ADDRESS_SIZE];
        tox_self_get_address(m, (uint8_t *) myid);

        if (log_enable(self->name, myid, NULL, ctx->log, LOG_PROMPT) == -1)
            line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Warning: Log failed to initialize.");
    }

    scrollok(ctx->history, 0);
    wmove(self->window, y2 - CURS_Y_OFFSET, 0);

    if (user_settings->show_welcome_msg == SHOW_WELCOME_MSG_ON)
        print_welcome_msg(self);
}
示例#3
0
inline void backto_os(){
	init_flag_position();	
	__asm__("pop %si");
	screen_init();
	__asm__("pop %si");
	print_welcome_msg();
	__asm__("pop %si");
	print_message();
	__asm__("pop %si");
	print_flag(); //root@wangqin4377@:   position
	__asm__("pop %si");
}
示例#4
0
//--------------------------------- SHELL core os.c---------
char listen_key(){
//	unsigned short int init_pos = get_pointer_pos();
	flag_len=17;
	char i = gets( key);
	screen_sc_T = 1;
	Print_flag_mark = 1;
	if( strcmp( key, "clear\0")){			// char *,const char *
		clear();
		return i;
	}

	if( strcmp( key, "python\0")){
		python();
		Print_flag_mark = 1;
		return i;
	}

	if( strcmp( key, "start\0")){
		clear();
		set_pointer_pos();
		Print_flag_mark = 0;
		Process();
		return i;
	}

	if( strcmp( key, "help\0")){
		//can't refer 2 two times, so...
		init_flag_position();	
		screen_init();
		print_welcome_msg();
		print_message();
		print_flag(); //root@wangqin4377@:   position

		return i;
	}
//---------------------------------mark: man xxx, run xxx,asc xx...
		
	if( synCheck( key, "run\0")){
		run( key);
		return i;
	}

	if( key[0] == '\0'){
		return i;
	}
	
	flag_scroll();
	set_pointer_pos();
	print_str("  No such file or Directory", 27);
	screen_sc_T = 2;
	return i;
}
示例#5
0
//--------------------------------- SHELL core os.c---------
char listen_key(){
//	unsigned short int init_pos = get_pointer_pos();
	flag_len=17;
	char i = gets( key);
	screen_sc_T = 1;
	Print_flag_mark = 1;
	if( strcmp( key, "clear\0")){			// char *,const char *
		clear();
		return i;
	}

	if( strcmp( key, "time\0")){
		time();
		return i;
	}

	if( strcmp( key, "date\0")){
		date();
		return i;
	}

	if( strcmp( key, "python\0")){
		python();
		return i;
	}
	if( strcmp( key, "start\0")){
		screen_init();
		Print_flag_mark = 0;
		Process();
		return i;
	}

	if( strcmp( key, "help\0")){
		//can't refer 2 two times, so...
		init_flag_position();	
		screen_init();
		print_welcome_msg();
		print_message();
		print_flag(); //root@wangqin4377@:   position

		return i;
	}
//---------------------------------mark: man xxx, run xxx,asc xx...

	if( synCheck( key, "asc\0")){
		asc( key);
		return i;
	}

	if( synCheck( key, "man\0")){
		man( key);
		return i;
	}	
	
	if( synCheck( key, "run\0")){
		run( key);
		return i;
	}

	if( synCheck( key, "syscall\0")){
		syscall_test();
		return i;
	}


	if( synCheck( key, "int\0")){
		if( strcmp( key, "int 33h")){
			__asm__(  "int $0x33");
			return i;
		}
		if( strcmp( key, "int 34h")){
			__asm__(  "int $0x34");
			return i;
		}
		if( strcmp( key, "int 35h")){
			__asm__(  "int $0x35");
			return i;
		}
		if( strcmp( key, "int 36h")){
			__asm__(  "int $0x36");
			return i;
		}
	}

	if( key[0] == '\0'){
		return i;
	}
	
	flag_scroll();
	set_pointer_pos();
	print_str("  No such file or Directory", 27);
	screen_sc_T = 2;
	return i;
}