Ejemplo n.º 1
0
/** 
 * Switch screen with switching workspace 
 *
 */
int		revm_screen_switch()
{
  PROFILER_IN(__FILE__, __FUNCTION__, __LINE__);
  if (revm_workspace_next() <= 0)
    PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__, 0);
  PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__, revm_screen_update(0, 1));
}
Ejemplo n.º 2
0
int      revm_create_new_workspace(char *ws_name)
{
  revmjob_t	*job;
  char		logbuf[BUFSIZ];

  PROFILER_IN(__FILE__, __FUNCTION__, __LINE__);

  if (!revm_valid_workspace(ws_name))
    PROFILER_ERR(__FILE__, __FUNCTION__, __LINE__,
                 "Incorrect workspace name", -1);

  job = hash_get(&world.jobs, ws_name);

  if (job == NULL)
    {
      /* create a new workspace */
      job = revm_clone_job(strdup(ws_name), world.curjob);
      hash_add(&world.jobs, ws_name, job);

      if (revm_own_job(job))
        {
          /* switch */
          snprintf(logbuf, BUFSIZ - 1, "\n [+] Workspace : %s \n\n", ws_name);
          revm_output(logbuf);
          revm_prompt_log();
          /* Switch to the new job */
          revm_switch_job(job);
          /* Update the screen */
          revm_screen_update(TRUE, 0);
          PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__, 0);
        }
    }
  else
    if (job->ws.active)
      {
        snprintf(logbuf, BUFSIZ - 1, "\n [+] Already in workspace : %s\n\n",
                 ws_name);
        revm_output(logbuf);
        PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__, 0);
      }

  PROFILER_ERR(__FILE__, __FUNCTION__, __LINE__, "Incorrect workspace name", -1);
}