예제 #1
0
int scr_keyh(struct wdgt *w, int key)
{
	int ret = KEY_HANDLED;
	DBG("calling key %c for %s", key, w->name);
	switch(key) {
		case KBD_DOWN: 		kbd_down(w); break;
		case KBD_UP:   		kbd_up(w); break;
		case KBD_PAGE_DOWN:	kbd_page_down(w); break;
		case KBD_PAGE_UP:	kbd_page_up(w); break;
		case KBD_LEFT:		kbd_left(w); break;
		case KBD_RIGHT:		kbd_right(w); break;
		case KBD_HOME:		ret = kbd_home(w); break;
		case KBD_END:		ret = kbd_end(w); break;
		default: 		ret = KEY_SKIPPED;
	} 
	return ret;
}
예제 #2
0
파일: settings.c 프로젝트: teclator/linuxrc
/*
 * return values:
 * -1    : abort (aka ESC)
 *  0    : ok
 *  other: stay in menu
 */
int set_expert_cb(dia_item_t di)
{
  int i;
  char *dev = NULL;
  file_t *f;

  di_set_expert_last = di;

  switch(di) {
    case di_expert_info:
      info_menu();
      break;

    case di_expert_modules:
      mod_menu();
      break;

    case di_expert_verify:
      util_choose_disk_device(&dev, 2, "Please choose the device to check.", "Enter the device to check.");
      if(dev) digest_media_verify(dev);
      break;

    case di_expert_eject:
      util_eject_cdrom(config.cdrom);
      break;

    case di_extras_info:
      util_status_info(0);
      break;

    case di_extras_change:
        i = dia_input2("Change config", &config.change_config, 35, 0);
        if(!i) {
          f = file_parse_buffer(config.change_config, kf_cfg + kf_cmd + kf_cmd_early);
          file_do_info(f, kf_cfg + kf_cmd + kf_cmd_early);
          file_free_file(f);
          net_update_ifcfg(IFCFG_IFUP);
        }
       break;

    case di_extras_shell:
        kbd_end(0);
        if(config.win) {
          disp_cursor_on();
        }
        if(!config.linemode) {
          printf("\033c");
          if(config.utf8) printf("\033%%G");
          fflush(stdout);
        }

        char *cmd = NULL;
        strprintf(&cmd, "PS1='\\w # ' %s 2>&1", config.debugshell ?: "/bin/sh");
        system(cmd);
        free(cmd);

        kbd_init(0);
        if(config.win) {
          disp_cursor_off();
          if(!config.linemode) disp_restore_screen();
        }
      break;

    default:
      break;
  }

  return 1;
}