Esempio n. 1
0
static void show_flag_status(void)
{
	int keypress;
	int flag_val;

	clear_line();
	bb_putchar('_');
	keypress = less_getch(1);

	switch (keypress) {
	case 'M':
		flag_val = option_mask32 & FLAG_M;
		break;
	case 'm':
		flag_val = option_mask32 & FLAG_m;
		break;
	case '~':
		flag_val = option_mask32 & FLAG_TILDE;
		break;
	case 'N':
		flag_val = option_mask32 & FLAG_N;
		break;
	case 'E':
		flag_val = option_mask32 & FLAG_E;
		break;
	default:
		flag_val = 0;
		break;
	}

	clear_line();
	printf(HIGHLIGHT"The status of the flag is: %u"NORMAL, flag_val != 0);
}
Esempio n. 2
0
static void add_mark(void)
{
	int letter;
	int mark_line;

	clear_line();
	printf("Mark: ");
	letter = tless_getch();

	if (isalpha(letter)) {
		mark_line = line_pos;

		/* If we exceed 15 marks, start overwriting previous ones */
		if (num_marks == 14)
			num_marks = 0;

		mark_lines[num_marks][0] = letter;
		mark_lines[num_marks][1] = line_pos;
		num_marks++;
	}
	else {
		clear_line();
		printf("%s%s%s", HIGHLIGHT, "Invalid mark letter", NORMAL);
	}
}
Esempio n. 3
0
//--------------------------------------------------------------
//record_floor_reqs() -- get requests from riders outside car
void building::record_floor_reqs()
   {
   char ch = 'x';             //utility char for input
   char ustring[BUF_LENGTH];  //utility string for input
   int iFloor;                //floor from which request made
   char chDirection;          //'u' or 'd' for up or down
   
   set_cursor_pos(1,22);      //bottom of screen
   cout << "Press [Enter] to call an elevator: ";
   if( !kbhit() )             //wait for keypress (must be CR)
      return;
   cin.ignore(10, '\n');
   if(ch=='\x1B')             //if escape key, end program
      exit(0);
   set_cursor_pos(1,22); clear_line();  //clear old text
   set_cursor_pos(1,22);      //bottom of screen
   cout << "Enter the floor you're on: ";
   cin.get(ustring, BUF_LENGTH);        //get floor
   cin.ignore(10, '\n');      //eat chars, including newline
   iFloor = atoi(ustring);    //convert to integer

   cout << "Enter direction you want to go (u or d): ";
   cin.get(chDirection);      //(avoid multiple linefeeds)
   cin.ignore(10, '\n');      //eat chars, including newline

   if(chDirection=='u' || chDirection=='U')
      floor_request[UP][iFloor-1] = true;  //up floor request
   if(chDirection=='d' || chDirection=='D')
      floor_request[DN][iFloor-1] = true;  //down floor request
   set_cursor_pos(1,22); clear_line();     //clear old text
   set_cursor_pos(1,23); clear_line();
   set_cursor_pos(1,24); clear_line();
   }  //end record_floor_reqs()
Esempio n. 4
0
static el_status_t h_search(void)
{
    static int Searching;
    const char *old_prompt;
    const char *(*move)(void);
    const char *p;

    if (Searching)
        return el_ring_bell();
    Searching = 1;

    clear_line();
    old_prompt = rl_prompt;
    rl_prompt = "Search: ";
    tty_puts(rl_prompt);
    move = Repeat == NO_ARG ? prev_hist : next_hist;
    p = editinput();
    rl_prompt = old_prompt;
    Searching = 0;
    tty_puts(rl_prompt);
    if (p == NULL && el_intr_pending > 0) {
        el_intr_pending = 0;
        clear_line();
        return redisplay();
    }
    p = search_hist(p, move);
    clear_line();
    if (p == NULL) {
        el_ring_bell();
        return redisplay();
    }
    return do_insert_hist(p);
}
Esempio n. 5
0
void
move_cursor_to_start_of_prompt(int erase)
{
  int termwidth = winsize.ws_col;
  int promptlen_on_screen, number_of_lines_in_prompt, curpos, count;
  int cooked = (saved_rl_state.cooked_prompt != NULL);
  
  DPRINTF2(DEBUG_READLINE,"prompt_is_still_uncooked: %d, impatient_prompt: %d", prompt_is_still_uncooked, impatient_prompt);
  if (prompt_is_still_uncooked && ! impatient_prompt)
    return; /* @@@ is this necessary ?*/

	
  promptlen_on_screen =  colourless_strlen_unmarked(saved_rl_state.cooked_prompt ? saved_rl_state.cooked_prompt : saved_rl_state.raw_prompt, termwidth);
  curpos = (within_line_edit ? 1 : 0); /* if the user has pressed a key the cursor will be 1 past the current prompt */
  assert(termwidth > 0); 
  number_of_lines_in_prompt = 1 +  ((promptlen_on_screen + curpos -1) / termwidth); /* integer arithmetic! (e.g. 171/80 = 2) */
  cr(); 
  for (count = 0; count < number_of_lines_in_prompt -1; count++) {
    if (erase)
      clear_line();
    curs_up();
  } 
  clear_line();
  DPRINTF4(DEBUG_READLINE,"moved cursor up %d lines (erase = %d, len=%d, cooked=%d)", number_of_lines_in_prompt - 1, erase, promptlen_on_screen, cooked); 
}       
Esempio n. 6
0
static void show_flag_status(void)
{
	int keypress;
	int flag_val;

	clear_line();
	putchar('_');
	keypress = tless_getch();

	switch (keypress) {
		case 'M':
			flag_val = flags & FLAG_M;
			break;
		case 'm':
			flag_val = flags & FLAG_m;
			break;
		case '~':
			flag_val = flags & FLAG_TILDE;
			break;
		case 'N':
			flag_val = flags & FLAG_N;
			break;
		case 'E':
			flag_val = flags & FLAG_E;
			break;
		default:
			flag_val = 0;
			break;
	}

	clear_line();
	printf("%s%s%i%s", HIGHLIGHT, "The status of the flag is: ", flag_val != 0, NORMAL);
}
Esempio n. 7
0
void init_display_buffer(ui_context * ctx)
{
	int i;
	font_type * font;

	font = font_list[ctx->font_id];

	ctx->screen_txt_xsize = ctx->SCREEN_XRESOL / font->char_x_size;
	ctx->screen_txt_ysize = (ctx->SCREEN_YRESOL / font->char_y_size);

	ctx->NUMBER_OF_ENTRIES_ON_DISPLAY = ctx->screen_txt_ysize - 2;          // (Display size minus top + bottom)
	ctx->NUMBER_OF_FILE_ON_DISPLAY = ctx->NUMBER_OF_ENTRIES_ON_DISPLAY - 1; // (Display size minus top + bottom + tittle)

	chg_video_conf(ctx);

	// Clear all lines.
	for(i=0;i<ctx->screen_txt_ysize;i++)
	{
		clear_line(ctx, i, 0 );
	}

	// Footprint : Current software / firmware version and title
	clear_line(ctx, ctx->screen_txt_ysize - 1, INVERTED);

	hxc_printf(ctx,LEFT_ALIGNED | INVERTED,0, ctx->screen_txt_ysize - 1,"FW %s",ctx->FIRMWAREVERSION);
	hxc_print(ctx,CENTER_ALIGNED | INVERTED,0,ctx->screen_txt_ysize - 1,(char*)title_msg);
	hxc_print(ctx,RIGHT_ALIGNED | INVERTED,0,ctx->screen_txt_ysize - 1,(char*)copyright_msg);

	// Top header : current folder path
	clear_line(ctx, 0, INVERTED);
	hxc_print(ctx,LEFT_ALIGNED|INVERTED,0,0, (char*)cur_folder_msg);
}
Esempio n. 8
0
static int find_command(char *line, int curr_index, int forward)
{
	int	res, cmd_ind, len, ind, c, line_size;
	char	str[READ_BUF_SIZE];
	char	text[READ_BUF_SIZE];

	len = strlen(line) + strlen(Title);
	clear_line(len, len);
	if (forward) {
		if (curr_index == current_hist_ind) {
			printf("%c", BELL_KEY);
			return(curr_index);
		}
	} else {
		if (curr_index <= 0) {
			printf("%c", BELL_KEY);
			return(0);
		}
	};
	memset(text, 0, READ_BUF_SIZE);
	len = 0;
	ind = 0;
	cmd_ind = curr_index;
	for (;;) {
		line_size = ind + strlen(History[cmd_ind]);
		if (forward)
			res = find_cmd_by_text(text, cmd_ind, 1);
		else
			res = find_cmd_by_text(text, cmd_ind, 0);
		if (res != -1)
			cmd_ind = res;
		else
			printf("%c", BELL_KEY);
		if (forward)
			snprintf(str, READ_BUF_SIZE,
				"(i-search)`%s': ", text);
		else
			snprintf(str, READ_BUF_SIZE,
				"(revers-i-search)`%s': ", text);
		clear_line(ind, line_size);
		ind = print_str_by_index(str, 0, -1);
		print_str_by_index(History[cmd_ind], 0, 0);
		c = getchar();
		if (c == BACKSP_KEY) {
			len--;
			if (len < 0) len = 0;
			text[len] = 0;
		} else if ((c < ' ') || (c > 'z')) {
			ungetc(c, stdin);
			break;
		};
		text[len++] = c;
		if (len >= READ_BUF_SIZE) break;
	};
	res = ind + strlen(History[cmd_ind]);
	clear_line(ind, res);
	return(cmd_ind);
}
Esempio n. 9
0
void exception_handler(int vec_no, int err_code, int eip, int cs, int eflags)
{
  char *err_msg[] = {
                      "#DE: Dvivde Error", 
		      "#DB: RESERVED",
		      "-- : NMI Interrupt", 
		      "#BP: Breakppoint",
		      "#OF: Overflow",
		      "#BR: BOUND Range Exceeded",
		      "#UD: Invalid Opcode (Undefined Opcode)",
		      "#NM: Device Not Available (No Math Coprocessor)",
		      "#DF: Double Fault",
		      "   : Coprocessor Segment Overrun (reserved)",
		      "#TS: Invalid TSS",
		      "#NP: Segment Not Present",
		      "#SS: Stack-Segment Fault",
		      "#GP: General Protection",
		      "#PF: Page Fault",
		      "-- : (Intel reserved. Do not use.)",
		      "#MF: x87 FPU Floating-Point Error (Math Fault)",
		      "#AC: Alignment Check",
		      "#MC: Machine Check",
		      "#XF: SIMD Floating-Point Exceprion"
                    };
  //clear();
  s32_print("exception_handler", (u8*)(0xb8000+160*24));

  u8 str[12]="";
  u8 *str_ptr = str;

  clear_line(0);
  clear_line(1);
  clear_line(2);
  clear_line(3);
  clear_line(23);

  s32_print(err_msg[vec_no], (u8*)(0xb8000+160*23));
  str_ptr = s32_itoa(eflags, str_ptr, 16);
  s32_print("eflags", (u8*)(0xb8000+160*0));
  s32_print(str_ptr, (u8*)(0xb8000+160*1));

  str_ptr = s32_itoa(cs, str_ptr, 16);
  s32_print("cs", (u8*)(0xb8000+160*2));
  s32_print(str_ptr, (u8*)(0xb8000+160*3));
  
  str_ptr = s32_itoa(eip, str_ptr, 16);
  clear_line(4);
  s32_print("eip", (u8*)(0xb8000+160*4));
  clear_line(5);
  s32_print(str_ptr, (u8*)(0xb8000+160*5));

  if (err_code != 0xffffffff)
  {
    str_ptr = s32_itoa(err_code, str_ptr, 16);
    clear_line(6);
    s32_print("err_code", (u8*)(0xb8000+160*6));
    clear_line(7);
    s32_print(str_ptr, (u8*)(0xb8000+160*7));
  }
}
Esempio n. 10
0
// *************************************************************************************************
// @fn          display_selection_altaccum
// @brief       Display altitude accumulator ON or OFF
// @param       u8 segments			where to display, usually LCD_SEG_L2_4_0
//				u32 index			0 = OFF, 1 = ON
//				u8 digits			Not used
//				u8 blanks			Not used
// @return      none
// *************************************************************************************************
void display_selection_altaccum (u8 segments, u32 index, u8 digits, u8 blanks)
{
    if (index) {
        clear_line(LINE2);
        display_chars(segments, (u8*)" ON  ", SEG_ON_BLINK_ON);		// display "ON" on bottom line
    }
    else {
        clear_line(LINE2);
        display_chars(segments, (u8*)" OFF ", SEG_ON_BLINK_ON);		// display "OFF" on bottom line
    }
}
// *************************************************************************************************
// @fn          display_update
// @brief       Process display flags and call LCD update routines.
// @param       none
// @return      none
// *************************************************************************************************
void display_update(void)
{
    unsigned char line;
    unsigned char string[8];

    // ---------------------------------------------------------------------
    // Call Line1 display function
    if (display.flag.full_update || display.flag.line1_full_update)
    {
        clear_line(LINE1);
        fptr_lcd_function_line1(LINE1, DISPLAY_LINE_UPDATE_FULL);
    } else if (ptrMenu_L1->display_update())
    {
        // Update line1 only when new data is available
        fptr_lcd_function_line1(LINE1, DISPLAY_LINE_UPDATE_PARTIAL);
    }

    // ---------------------------------------------------------------------
    // If message text should be displayed on Line2, skip normal update
    if (message.flag.show)
    {
        line = LINE2;

        // Select message to display
        if (message.flag.type_locked)
            memcpy(string, "  LO?T", 6);
        else if (message.flag.type_unlocked)
            memcpy(string, "  OPEN", 6);

        // Clear previous content
        clear_line(line);
        fptr_lcd_function_line2(line, DISPLAY_LINE_CLEAR);

        // Next second tick erases message and repaints original screen content
        message.all_flags = 0;
        message.flag.erase = 1;
    }
    // ---------------------------------------------------------------------
    // Call Line2 display function
    else if (display.flag.full_update || display.flag.line2_full_update)
    {
        clear_line(LINE2);
        fptr_lcd_function_line2(LINE2, DISPLAY_LINE_UPDATE_FULL);
    } else if (ptrMenu_L2->display_update() && !message.all_flags)
    {
        // Update line2 only when new data is available
        fptr_lcd_function_line2(LINE2, DISPLAY_LINE_UPDATE_PARTIAL);
    }

    // Clear display flag
    display.all_flags = 0;
}
Esempio n. 12
0
void CaenVmeIrqCheck(int32_t BHandle, man_par_t *man)
{
    CVErrorCodes        ret ;

    con_printf(" CHECK IRQ\n");

    CAENVME_IRQCheck(BHandle,&man->irqstat);            // Check IRQ Status

    con_printf(" IRQ status: %02X\n",man->irqstat);
    con_printf(" Interrupt Level to Acknowledge (0 to exit) : ");  // Get the int level   
    con_scanf("%x",&man->level); 

    if (man->level == 0)
    {
        clear_line(Y_COMM);
        clear_line(Y_COMM+1);
        clear_line(Y_COMM+2);
        return ;
    }

    con_printf_xy(X_COMM,Y_COMM+2," Waiting for interrupt ... Press any key to stop.");

    while (!(man->irqstat & (1<<(man->level-1))) && !con_kbhit())   // Check Int loop
        CAENVME_IRQCheck(BHandle,&man->irqstat);

    gotoxy(X_COMM,Y_COMM) ;

    if(man->irqstat & (1<<(man->level-1)))
    {

        ret = CAENVME_IACKCycle(BHandle,man->level,&man->data,man->dtsize);
 
        switch (ret)
        {
        case cvSuccess   : con_printf(" Cycle completed normally\n");                                                       
            con_printf(" Int. Ack. on IRQ%d: StatusID = %0X",man->level,man->data);
            break ;
        case cvBusError  : con_printf(" Bus Error !!!");
            break ;                                
        case cvCommError : con_printf(" Communication Error !!!");
            break ;
        default          : con_printf(" Unknown Error !!!");
            break ;


        }
    }
    else
        con_printf(" Interrupt request IRQ%d not active",man->level);
     
}
Esempio n. 13
0
void update_display(void) {
  void (*display_handler)(char*,char*) = state_handlers[state].display;
  char line_1[17];
  char line_2[17];
  
  clear_line(line_1);
  clear_line(line_2);
  
  if (display_handler == NULL) return;
  
  display_handler(line_1, line_2);
  display_line(LCD_LINE_1, line_1);
  display_line(LCD_LINE_2, line_2);
}
Esempio n. 14
0
File: cmenu.c Progetto: jkkm/xfsdump
/*ARGSUSED*/
int
menu_import(WINDOW *win, node_t *current, node_t *list)
{
    char inv_path[MAXPATHLEN];
    struct stat s;
    char *fstabname;
    data_t *d;

    for(;;) {
	inv_path[0] = '\0';

	if(get_string(win, "Path to inventory to be imported: ", inv_path, MAXPATHLEN) == ERR) {
	    put_error("Error: invalid input");
	    continue;
	}
	if(strlen(inv_path) == 0) {
	    clear_line(stdscr, LINES - 1);
	    return BOOL_FALSE;
	}
	if(stat(inv_path, &s) < 0 || !S_ISDIR(s.st_mode)) {
	    put_error("Error: invalid path");
	    continue;
	}
	clear_line(stdscr, LINES - 1);

	fstabname = GetFstabFullPath(inv_path);
	if(fstabname == NULL) {
	    put_footer("internal memory error: import inventory", ALIGN_LEFT);
	    exit(1);
	}

	while(current->next != NULL) {
	    current = current->next;
	}
	generate_fstab_menu(inv_path, current, 0, fstabname);
	free(fstabname);

	while(current->next != NULL) {
	    current = current->next;
	    d = current->data;
	    d->text[1] = 'I';
	    d->imported = BOOL_TRUE;
	}
	redraw_screen = BOOL_TRUE;
	break;
    }

    return BOOL_FALSE;
}
Esempio n. 15
0
void
chg_dir()
{
	extern int fd;
	WINDOW *ch_win, *newwin();
	char *ans, *dir, *expand(), *cwd, *getcwd(), cwdbuf[200];
	char *get_str();

	cwd = getcwd(cwdbuf, 200);

	ch_win = newwin(6, 70, 5, 5);

	mvwprintw(ch_win, 2, 4, "Current directory: %s", cwd);
	mvwaddstr(ch_win, 3, 4, "New directory: ");
	box(ch_win, VERT, HORZ);

	mvwattrstr(ch_win, 0, 3, A_BOLD, " Change directory ");
	wmove(ch_win, 3, 19);
	wrefresh(ch_win);
					/* get the answer */
	while ((ans = get_str(ch_win, 80, "", " \t\n")) != NULL) {
					/* a CR means no change */
		if (*ans == '\0')
			break;
					/* expand the input */
		dir = expand(ans);
					/* if you have search permission */
		if (!access(dir, 1)) {
			if (!chdir(dir))
				break;
		}
		beep();
		mvwattrstr(ch_win, 4, 15, A_BOLD, "No such directory or no access permission");
		wrefresh(ch_win);
		wait_key(ch_win, 3);
					/* clean up the mess */
		clear_line(ch_win, 3, 19, TRUE);
		clear_line(ch_win, 4, 14, TRUE);
		wmove(ch_win, 3, 19);
		wrefresh(ch_win);
	}
	if (fd == -1) {
		werase(ch_win);
		wrefresh(ch_win);
	}
	delwin(ch_win);
	return;
}
Esempio n. 16
0
//-----------------------------------------------------------------------------
void graphics::show_time(const tm* lcTime, int line_no)
{
	const int SIZE = 50;
	int length;
	int xCo;
	char memBuff[SIZE];
	ostrstream oMemBuff(memBuff, SIZE);
	oMemBuff << dayOfWeek[lcTime->tm_wday] << ", " << lcTime->tm_mday << ' '
		<< months[lcTime->tm_mon] << ' ' << lcTime->tm_year + 1900 << ". ";
	if(lcTime->tm_hour < 10)
		oMemBuff << '0' << lcTime->tm_hour << " : ";
	else
		oMemBuff << lcTime->tm_hour << " : ";
	if(lcTime->tm_min < 10)
		oMemBuff << '0' << lcTime->tm_min << " : ";
	else
		oMemBuff << lcTime->tm_min << " : ";
	if(lcTime->tm_sec < 10)
		oMemBuff << '0' << lcTime->tm_sec;
	else
		oMemBuff << lcTime->tm_sec;
	oMemBuff << '\0';
	length = strlen(memBuff);
	xCo = (console_size.X - length) / 2;
	set_cursor_pos(1, line_no);
	clear_line();
	set_cursor_pos(xCo, line_no);
	cout << memBuff;
}
Esempio n. 17
0
File: read.c Progetto: Fusiow/msh
int		distrib_buttons(int i, char **result, char *buffer, int *v)
{
	if (buffer[0] == 10)
		return (-2);
	else if (buffer[0] == 27 && buffer[1] == 91)
		i = distrib_arrow(i, result, buffer, v);
	else if (buffer[0] == 127)
		*result = del_c(*result, &i);
	else if (buffer[0] == 9 && *result && i == ft_strlen(*result))
		i = distrib_tab(i, result);
	else if (buffer[0] == 12)
		clear_and_prompt();
	else if (buffer[0] == 1)
		i = ctrl_a(i, result);
	else if (buffer[0] == 5)
		i = ctrl_k(i, result);
	else if (buffer[0] == 21)
	{
		clear_line(i + 1, ft_strlen(*result));
		*result = NULL;
		i = 0;
	}
	else if (buffer[0] == 4)
		ft_exit(NULL);
	else
		ft_putstr(tgetstr("le", NULL));
	return (i);
}
Esempio n. 18
0
static void buffer_line(int linenum)
{
	int i;
	past_eof = 0;

	if (linenum < 0 || linenum > num_flines) {
		clear_line();
		printf("%s%s%i%s", HIGHLIGHT, "Cannot seek to line number ", linenum + 1, NORMAL);
	}
	else if (linenum < (num_flines - height - 2)) {
		for (i = 0; i < (height - 1); i++) {
			free(buffer[i]);
			buffer[i] = bb_xstrdup(flines[linenum + i]);
		}
		line_pos = linenum;
		buffer_print();
	}
	else {
		for (i = 0; i < (height - 1); i++) {
			free(buffer[i]);
			if (linenum + i < num_flines + 2)
				buffer[i] = bb_xstrdup(flines[linenum + i]);
			else
				buffer[i] = bb_xstrdup((flags & FLAG_TILDE) ? "\n" : "~\n");
		}
		line_pos = linenum;
		/* Set past_eof so buffer_down and buffer_up act differently */
		past_eof = 1;
		buffer_print();
	}
}
Esempio n. 19
0
void
draw_keybindings(PANEL *panel, const char *keybindings[], int count)
{
    int height, width, key, xpos = 0;

    // Get window available space
    WINDOW *win = panel_window(panel);
    getmaxyx(win, height, width);

    // Reverse colors on monochrome terminals
    if (!has_colors())
        wattron(win, A_REVERSE);

    // Write a line all the footer width
    wattron(win, COLOR_PAIR(CP_DEF_ON_CYAN));
    clear_line(win, height - 1);

    // Draw keys and their actions
    for (key = 0; key < count; key += 2) {
        wattron(win, A_BOLD | COLOR_PAIR(CP_WHITE_ON_CYAN));
        mvwprintw(win, height - 1, xpos, "%-*s", strlen(keybindings[key]) + 1, keybindings[key]);
        xpos += strlen(keybindings[key]) + 1;
        wattroff(win, A_BOLD | COLOR_PAIR(CP_WHITE_ON_CYAN));
        wattron(win, COLOR_PAIR(CP_BLACK_ON_CYAN));
        mvwprintw(win, height - 1, xpos, "%-*s", strlen(keybindings[key + 1]) + 1,
                  keybindings[key + 1]);
        wattroff(win, COLOR_PAIR(CP_BLACK_ON_CYAN));
        xpos += strlen(keybindings[key + 1]) + 3;
    }

    // Disable reverse mode in all cases
    wattroff(win, A_REVERSE);
}
Esempio n. 20
0
u8 update_schedule()
{
	update_schedule_time();
	clear_line(LINE2);
	if(sSchedule.state == SCHEDULE_ENABLED)
	{
		if(sSchedule.currentlyShown == PERIOD)
		{
			display_chars(LCD_SEG_L2_4_0, sSchedule.period, SEG_ON);
		}
		else if(sSchedule.currentlyShown == TIME)
		{
			display_chars(LCD_SEG_L2_3_0, itoa(sSchedule.end, 4, 0), SEG_ON);
			display_symbol(LCD_SEG_L2_COL0, SEG_ON);
		}
	}
	else if (sSchedule.state == SCHEDULE_DISABLED)
	{
		display_chars(LCD_SEG_L2_4_0, sSchedule.period, SEG_ON);
	}
	/*else if (sSchedule.state == SCHEDULE_NONE)
	{
		if (is_schedule())
		{
			menu_skip_next(LINE2);
		}
	}*/
	return 1;
}
Esempio n. 21
0
void	move_history_down(t_prompt *prompt, char **history)
{
  int	max_hist;

  max_hist = dlen(history);
  clear_line(prompt);
  ++prompt->curr_history;
  while (prompt->curr_history < max_hist
	 && prompt->count_char > 0
	 && !strncmp(prompt->line,
		     history[prompt->curr_history], prompt->count_char))
    ++prompt->curr_history;
  if (prompt->curr_history == dlen(history))
    {
      memcpy(prompt->line, prompt->tmp_history, strlen(prompt->tmp_history));
      prompt->count_char = strlen(prompt->tmp_history);
    }
  else
    {
      memcpy(prompt->line, history[prompt->curr_history],
      strlen(history[prompt->curr_history]));
      prompt->count_char = strlen(history[prompt->curr_history]);
    }
  prompt->count_pos = prompt->count_char;
}
Esempio n. 22
0
static void match_left_bracket(char bracket)
{
	int bracket_line = -1;
	int i;

	clear_line();

	if (strchr(flines[line_pos + height - 2], bracket) == NULL) {
		printf("%s%s%s", HIGHLIGHT, "No bracket in bottom line", NORMAL);
		printf("%s", flines[line_pos + height]);
		sleep(4);
	}
	else {
		for (i = line_pos + height - 2; i >= 0; i--) {
			if (strchr(flines[i], opp_bracket(bracket)) != NULL) {
				bracket_line = i;
				break;
			}
		}

		if (bracket_line == -1)
			printf("%s%s%s", HIGHLIGHT, "No matching bracket found", NORMAL);

		buffer_line(bracket_line);
	}
}
Esempio n. 23
0
/*-----------------------------------------------------------------------------------*/
static void
s_ctk_draw_clear(unsigned char y1, unsigned char y2)
{
  for(i = y1; i < y2; ++i) {
    clear_line(i);
  }
}
Esempio n. 24
0
uint8_t LCD_service::display_TUN_packet(uint8_t* m_TUN_storage)
{
	// x and y coordinates
	uint8_t x = 0;
	uint8_t y = 0;
	uint8_t LCD_payload_sz = 0;

	// temp storage
	uint8_t LCD_payload[MED_BUFF_SZ];
	
	// extract the LCD packet
	LCD_payload_sz = m_util.get_TUN_payload(m_TUN_storage, LCD_payload, MED_BUFF_SZ);
	
	if(LCD_payload_sz != 0)
	{
	
		// get the X and Y coordinates
		x = m_util.hex_to_int(LCD_X_START, LCD_X_END, LCD_X_SZ, LCD_payload);
		y = m_util.hex_to_int(LCD_Y_START, LCD_Y_END, LCD_Y_SZ, LCD_payload);
	
		// figure out the msg size
		LCD_payload_sz -= (LCD_X_SZ + LCD_Y_SZ);
	
		// clear the line
		clear_line(x);
	
		// set the cursor
		lcd_setCursor(x, y);
	
		// display the string
		for(uint8_t i = 0; i < LCD_payload_sz; i++)
			lcd_putc((const char)LCD_payload[i+LCD_MSG_START]);
	}
}
Esempio n. 25
0
// *************************************************************************************************
// @fn          sx_rfbsl
// @brief       This functions starts the RFBSL
// @param       line            LINE1, LINE2
// @return      none
// *************************************************************************************************
void sx_rfbsl(u8 line)
{
    // Exit if battery voltage is too low for radio operation
    if (sys.flag.low_battery)
        return;

    // Exit if BlueRobin stack is active
    if (is_bluerobin())
        return;

    // Exit if SimpliciTI stack is active
    if (is_rf())
        return;

    rfBSL_button_confirmation++;

    if (rfBSL_button_confirmation == 2)
    {
        // Before entering RFBSL clear the LINE1 Symbols
        display_symbol(LCD_SYMB_AM, SEG_OFF);

        clear_line(LINE1);

        // Write RAM to indicate we will be downloading the RAM Updater first
        display_chars(LCD_SEG_L2_5_0, (u8 *) " RFBSL", SEG_ON);
        display_chars(LCD_SEG_L1_3_0, (u8 *) " RAM", SEG_ON);

        // Call RFBSL
        CALL_RFSBL();
    }
}
Esempio n. 26
0
static void flag_change(void)
{
	int keypress;

	clear_line();
	putchar('-');
	keypress = tless_getch();

	switch (keypress) {
		case 'M':
			flags ^= FLAG_M;
			break;
		case 'm':
			flags ^= FLAG_m;
			break;
		case 'E':
			flags ^= FLAG_E;
			break;
		case '~':
			flags ^= FLAG_TILDE;
			break;
		default:
			break;
	}
}
Esempio n. 27
0
static void flag_change(void)
{
	int keypress;

	clear_line();
	bb_putchar('-');
	keypress = less_getch(1);

	switch (keypress) {
	case 'M':
		option_mask32 ^= FLAG_M;
		break;
	case 'm':
		option_mask32 ^= FLAG_m;
		break;
	case 'E':
		option_mask32 ^= FLAG_E;
		break;
	case '~':
		option_mask32 ^= FLAG_TILDE;
		break;
	case 'S':
		option_mask32 ^= FLAG_S;
		buffer_fill_and_print();
		break;
#if ENABLE_FEATURE_LESS_LINENUMS
	case 'N':
		option_mask32 ^= FLAG_N;
		re_wrap();
		buffer_fill_and_print();
		break;
#endif
	}
}
Esempio n. 28
0
/* Print the status line */
static void status_print(void)
{
	const char *p;

	if (less_gets_pos >= 0) /* don't touch statusline while input is done! */
		return;

	/* Change the status if flags have been set */
#if ENABLE_FEATURE_LESS_FLAGS
	if (option_mask32 & (FLAG_M|FLAG_m)) {
		m_status_print();
		return;
	}
	/* No flags set */
#endif

	clear_line();
	if (cur_fline && cur_fline < (int)(max_fline - max_displayed_line)) {
		bb_putchar(':');
		return;
	}
	p = "(END)";
	if (!cur_fline)
		p = filename;
	if (num_files > 1) {
		printf(HIGHLIGHT"%s (file %i of %i)"NORMAL,
				p, current_file, num_files);
		return;
	}
	print_hilite(p);
}
Esempio n. 29
0
void
call_list_draw_header(PANEL *panel)
{
    const char *infile, *coldesc;
    int height, width, colpos, collen, i;

    // Get panel info
    call_list_info_t *info = call_list_info(panel);

    // Let's draw the fixed elements of the screen
    WINDOW *win = panel_window(panel);
    getmaxyx(win, height, width);

    // Draw panel title
    draw_title(panel, "sngrep - SIP messages flow viewer");

    // Draw a Panel header lines
    clear_line(win, 1);
    if ((infile = capture_get_infile()))
        mvwprintw(win, 1, width - strlen(infile) - 11, "Filename: %s", infile);
    mvwprintw(win, 2, 2, "Display Filter: ");
    mvwprintw(win, 1, 2, "Current Mode: %s", capture_get_status_desc());

    // Reverse colors on monochrome terminals
    if (!has_colors())
        wattron(win, A_REVERSE);

    // Draw columns titles
    wattron(win, A_BOLD | COLOR_PAIR(CP_DEF_ON_CYAN));
    mvwprintw(win, 3, 0, "%*s", width, "");
    for (colpos = 6, i = 0; i < info->columncnt; i++) {
        // Get current column width
        collen = info->columns[i].width;
        // Get current column title
        coldesc = sip_attr_get_title(info->columns[i].id);

        // Check if the column will fit in the remaining space of the screen
        if (colpos + strlen(coldesc) >= width)
            break;
        mvwprintw(win, 3, colpos, "%.*s", collen, coldesc);
        colpos += collen + 1;
    }
    // Print Autoscroll indicator
    if (info->autoscroll)
        mvwprintw(win, 3, 0, "A");
    wattroff(win, A_BOLD | A_REVERSE | COLOR_PAIR(CP_DEF_ON_CYAN));

    // Get filter call counters
    sip_calls_stats(&info->callcnt, &info->dispcallcnt);

    // Print calls count (also filtered)
    mvwprintw(win, 1, 35, "%*s", 35, "");
    if (info->callcnt != info->dispcallcnt) {
        mvwprintw(win, 1, 35, "Dialogs: %d (%d displayed)", info->callcnt, info->dispcallcnt);
    } else {
        mvwprintw(win, 1, 35, "Dialogs: %d", info->callcnt);
    }

}
Esempio n. 30
0
void CaenVmeRead(int32_t BHandle, man_par_t *man)
{
    uint32_t            i,old_data=0 ;
    CVErrorCodes        ret,old_ret=cvSuccess;


    if(man->dtsize == cvD64)
    {
        con_printf(" Can't execute a D64 Read Cycle");
        return ;
    }

    if(man->ncyc == 0)                          // Infinite Loop
        con_printf_xy(X_COMM,Y_COMM+2," Running ...    Press any key to stop.");

    for (i=0; ((man->ncyc==0) || (i<man->ncyc)) && !con_kbhit(); i++)
    {

        ret = CAENVME_ReadCycle(BHandle,man->addr,&man->data,man->am,man->dtsize);

        if((i==0) || (ret != old_ret))
        {
            gotoxy(X_COMM,Y_COMM) ;

            switch (ret)
            {
            case cvSuccess   : con_printf(" Cycle(s) completed normally\n");
                if((i==0) || (old_data != man->data))  
                {                    
                    if( man->dtsize == cvD32 )
                        con_printf(" Data Read : %08X",man->data);
                    if( man->dtsize == cvD16 )
                        con_printf(" Data Read : %04X",man->data & 0xffff);
                    if( man->dtsize == cvD8 )
                        con_printf(" Data Read : %02X",man->data & 0xff);
                }
                break ;
            case cvBusError      : con_printf(" Bus Error !!!");
                break ;                            
            case cvCommError : con_printf(" Communication Error !!!");
                break ;
            default          : con_printf(" Unknown Error !!!");
                break ;
            }
        }

        old_data = man->data;
        old_ret = ret;

        if(man->autoinc)
        {
            man->addr += man->dtsize;                       // Increment address (+1 or +2 or +4)       
            con_printf_xy(X_ADDR,Y_ADDR,"%08X]",man->addr);     // Update the screen
        }
    }
    
    if(man->ncyc == 0)
        clear_line(Y_COMM+2);
}