Exemplo n.º 1
0
/*the init function, initializes the basic environment of the shell*/
void
shell_init(void)
{
  prompt = (char*)malloc(sizeof(char[16]));
  cwd = (char*) malloc(sizeof(char[255]));
  last_dir = (char*)malloc(sizeof(char[255])); 
  strcpy(last_dir, "");

  cmd_char = (char*)calloc(1, sizeof(char[255]));
  cmd_head = (struct cmd*) malloc(sizeof(struct cmd));
  cmd_head->element = NULL;
  cmd_head->next = NULL;

  p = (char*)malloc(sizeof(char[128]));
  printf("*** Welcome to Shell ! ***\n");
  path_list = (struct pathelement*)malloc (sizeof(struct pathelement));
  path_list -> next = NULL;
  path_list -> element = NULL;
  if (getcwd(cwd, 255) == NULL) {
    printf("Shell: getcwd error: %s\n", strerror(errno));
  }
  /* This is just first_step initialization 
   * to prevent myself from forgetting it 
   * as well as my hands are cut as a consequence...
   */
  strcpy(prompt, "user");
  bg_init();

  path_list = get_path();
  print_env_path();
  alias_init();
  history_init();
  noclobber = 0;
}
Exemplo n.º 2
0
void core_init() {
    glob_shell = (struct glob_shell *)malloc(sizeof(glob_shell));
    glob_shell->lreturn = 0;
    glob_shell->bashcompat = 0;
    glob_shell->lvar_tbl = tbl_init(1024);
    alias_init(1024);
    builtin_init();
}
Exemplo n.º 3
0
Arquivo: alias.c Projeto: oracc/oracc
/* suck the aliases db into an in-memory hash table for
   faster access by sf_index; callers using this should
   check alias status with the macro `alias_fast_get_alias' */
void
alias_fast_init (const char *project, const char *index)
{
    Uchar *key;
    alias_init (project, index);
    if (aliases_dip)
    {
        aliases = hash_create (0);
        while (NULL != (key = dbi_each (aliases_dip)))
            hash_add (aliases, (unsigned char *)xstrdup ((const char*)key),
                      dbi_detach_data (aliases_dip, NULL));
        alias_term ();
    }
    else
        aliases = NULL;
}
Exemplo n.º 4
0
Arquivo: msh.c Projeto: aicastell/msh
/**************************************************************
* Esta funcion reserva memoria para todas las variables que lo*
* requieren e inicializa todas las estructuras globales que he*
* definido como son ALIAS, ENTORNO y PID.                     *
**************************************************************/
void LoadShell( char *EXENAME )
{
    char buf[MAXLENCAD];

    printf( "Loading %s shell.\n", EXENAME );
    printf( "Please, wait a moment... \n\n" );

    shNAME = strdup( EXENAME );

    initdir = strdup( getcwd(buf, MAXLENCAD) );

    userHOME = strdup( getenv("HOME") );
    chdir(userHOME);

    alias_init();
    alias_loadefault();

    entorno_init();

    entorno_loadefault();

    pid_init();

}/*LoadShell*/
Exemplo n.º 5
0
void
create_view(void)
{
//    Window              win, ewin;
    Evas               *evas;
    Ecore_Evas * ee;
    int                 x, y, w, h, res;
    int                 maxcol;
    int                 engine;
    char               *fontdir;
    int                 font_cache, image_cache;
    char buf[4096];
    char *s;

    E_DB_INT_GET(shell->rcfile, "/main_win/win_x", x, res);
    ENGY_ASSERT(res);

    E_DB_INT_GET(shell->rcfile, "/main_win/win_y", y, res);
    ENGY_ASSERT(res);

    E_DB_INT_GET(shell->rcfile, "/main_win/win_w", w, res);
    ENGY_ASSERT(res);

    E_DB_INT_GET(shell->rcfile, "/main_win/win_h", h, res);
    ENGY_ASSERT(res);

    E_DB_STR_GET(shell->rcfile, "/aliases", (shell->aliases), res);
    ENGY_ASSERT(res);

    E_DB_INT_GET(shell->rcfile, "/maxcolors", maxcol, res);
    ENGY_ASSERT(res);

    E_DB_INT_GET(shell->rcfile, "/rendermethod", engine, res);
    ENGY_ASSERT(res);
    if (render_method != -1)
        engine = render_method;

    E_DB_INT_GET(shell->rcfile, "/maximagecache", image_cache, res);
    ENGY_ASSERT(res);

    E_DB_INT_GET(shell->rcfile, "/maxfontcache", font_cache, res);
    ENGY_ASSERT(res);
    
    E_DB_STR_GET(shell->rcfile, "/fontdir", s, res);
    ENGY_ASSERT(res);
    if (s[0] != '/')
    {
	snprintf(buf, 4000,"%s/%s", shell->home, s);
	imlib_add_path_to_font_path(buf);
	fontdir = DUP(buf);
    }
    else
    {
	imlib_add_path_to_font_path(s);
	fontdir = DUP(s);
    }
    FREE(s);
    
    
/*    win = ecore_window_new(0, x, y, w, h);
    ecore_window_set_events(win, XEV_CONFIGURE | XEV_KEY);
    
    evas = evas_new_all(ecore_display_get(),
                        win,
                        0,
                        0,
                        w, h, engine, maxcol, font_cache, image_cache, fontdir);
    ENGY_ASSERTS(evas, "evas_new");
    FREE(fontdir);
    evas_set_output_viewport(evas, 0, 0, w, h);
    ewin = evas_get_window(evas);
    ecore_window_set_events(ewin, XEV_EXPOSE | XEV_BUTTON | XEV_MOUSE_MOVE);
*/

    if (!ecore_x_init(NULL))
	    exit(-1);
	    //LOG_AND_RETURN (ERR_EFL);
    
    if (!ecore_evas_init())
	    exit(-1);
	    //LOG_AND_RETURN (ERR_EFL);
    
    ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 640, 480);
    
    if (!ee)
	    exit(-1);
	    //LOG_AND_RETURN (ERR_EFL);
    
    evas = ecore_evas_get(ee);
    evas_font_path_prepend(evas, fontdir);
    FREE(fontdir);
    ecore_evas_callback_delete_request_set(ee, engy_delete_request);
    ecore_evas_callback_pre_render_set(ee, engy_pre_rend);
    ecore_evas_callback_post_render_set(ee, engy_post_rend);
    ecore_evas_callback_resize_set(ee, engy_resize);
    ecore_evas_name_class_set(ee, "engy", "main");
    ecore_evas_show(ee);
    
    _get_title_dcd();

    shell->title = my_iconv(shell->title_dcd, TITLE);
    ecore_evas_title_set(ee, shell->title);

    shell->evas = evas;
    shell->win = ecore_evas_software_x11_window_get(ee);
    shell->ee = ee;
    shell->w = w;
    shell->h = h;

    // GLS
//    ecore_set_blank_pointer(win);
//    ecore_window_set_title(win, shell->title);
//  my_evas_init();
    _shell_bg_create();
    menu_init();
    // GLS
    engy_cl_init();
    cl_configure(w, h);
    log_init();
    info_init();
    info_sync();
    panel_init();
    pointer_init();
    serv_init();
    logo_init();
    alias_init();
//    evas_render(shell->evas);
}