Ejemplo n.º 1
0
void init_disp_state() {
  int i;

  /* initialize the display state */
  disp.first_visible = 0;
  disp.highlighted = 0;

  SLtt_set_color(0, NULL, "lightgray", "default");
  SLtt_set_color(1, NULL, "black", "lightgray");
  SLtt_set_color(2, NULL, "lightgray", "blue");
  SLtt_set_color(3, NULL, "red", "blue");

  SLtt_set_cursor_visibility(0);

  for(i = 0; i < 10; i++) {
    disp.fkey_cmd[i] = NULL;
  }

  load_rc_file();
}
Ejemplo n.º 2
0
OMX_ERRORTYPE
tiz_rcfile_init (tiz_rcfile_t **pp_rc)
{
  int i;
  tiz_rcfile_t *p_rc = NULL;
  char *p_env_str = NULL;

  assert (pp_rc);

  /* load rc files */
  TIZ_LOG (TIZ_PRIORITY_TRACE, "Looking for [%d] rc files...", g_nrcfiles);

  snprintf(rcfiles[0].name, sizeof(rcfiles[0].name) - 1, "%s",
           getenv("TIZONIA_RC_FILE") ? getenv("TIZONIA_RC_FILE") : "");

  snprintf (rcfiles[1].name, sizeof(rcfiles[0].name) - 1, "%s/tizonia.conf",
            SYSCONFDIR);

  if (g_nrcfiles >= 3 && (p_env_str = getenv ("HOME")))
    {
      TIZ_LOG (TIZ_PRIORITY_TRACE, "HOME [%s] ...", p_env_str);
      snprintf (rcfiles[2].name, sizeof(rcfiles[2].name) - 1,
                "%s/.tizonia.conf", p_env_str ? p_env_str : "");
    }

  if (!(p_rc = (tiz_rcfile_t *)tiz_mem_calloc (1, sizeof(tiz_rcfile_t))))
    {
      TIZ_LOG (TIZ_PRIORITY_TRACE,
               "Could not allocate memory "
               "for tiz_rcfile_t...");
      return OMX_ErrorInsufficientResources;
    }

  for (i = 0; i < g_nrcfiles; i++)
    {
      TIZ_LOG (TIZ_PRIORITY_TRACE, "Checking for rc file at [%s]",
               rcfiles[i].name);
      /* Check file existence and user's read access */
      if (0 != access (rcfiles[i].name, R_OK))
        {
          TIZ_LOG (TIZ_PRIORITY_TRACE,
                   "rc file [%s] does not exist or "
                   "user has no read access permission",
                   rcfiles[i].name);
          continue;
        }

      /* Store stat's ctime */
      if (stat_ctime (rcfiles[i].name, &rcfiles[i].ctime) != 0)
        {
          TIZ_LOG (TIZ_PRIORITY_TRACE, "stat_ctime for [%s] failed",
                   rcfiles[i].name);
        }

      rcfiles[i].exists = 1;

      if (0 != load_rc_file (&rcfiles[i], p_rc))
        {
          TIZ_LOG (TIZ_PRIORITY_TRACE, "Loading [%s] rc file failed",
                   rcfiles[i].name);
        }
      else
        {
          TIZ_LOG (TIZ_PRIORITY_TRACE, "Loading [%s] rc file succeeded",
                   rcfiles[i].name);
        }
    }

  if (p_rc->count)
    {
      *pp_rc = p_rc;
    }
  else
    {
      *pp_rc = NULL;
    }

  return OMX_ErrorNone;
}