/* * exit ettercap */ void gtkui_exit(void) { int left, top, width, height; DEBUG_MSG("gtkui_exit"); gtk_window_get_position(GTK_WINDOW (window), &left, &top); gtk_window_get_size(GTK_WINDOW (window), &width, &height); gtkui_conf_set("window_left", left); gtkui_conf_set("window_top", top); gtkui_conf_set("window_width", width); gtkui_conf_set("window_height", height); gtk_main_quit(); gtkui_conf_save(); clean_exit(0); }
void gtkui_conf_read(void) { FILE *fd; char *path; char line[50], name[30]; short value; #ifdef OS_WINDOWS path = ec_win_get_user_dir(); #else /* TODO: get the dopped privs home dir instead of "/root" */ /* path = g_get_home_dir(); */ path = g_get_tmp_dir(); #endif filename = g_build_filename(path, ".ettercap_gtk", NULL); DEBUG_MSG("gtkui_conf_read: %s", filename); fd = fopen(filename, "r"); if(!fd) return; while(fgets(line, 100, fd)) { sscanf(line, "%s = %hd", name, &value); gtkui_conf_set(name, value); } fclose(fd); }
void gtkui_conf_read(void) { FILE *fd; const char *path; char line[100], name[30]; short value; /* If you launch ettercap using sudo, then the config file is your user config dir */ path = g_get_user_config_dir(); filename = g_build_filename(path, "ettercap_gtk", NULL); DEBUG_MSG("gtkui_conf_read: %s", filename); fd = fopen(filename, "r"); if(!fd) return; while(fgets(line, 100, fd)) { char *p = strchr(line, '='); if(!p) continue; *p = '\0'; strlcpy(name, line, sizeof(name)); g_strstrip(name); value = atoi(p + 1); gtkui_conf_set(name, value); } fclose(fd); }