| 2712 | |
| 2713 | */ |
| 2714 | char *fn; |
| 2715 | FILE *f; |
| 2716 | char buf[MC_MAXPATHLEN + 100]; |
| 2717 | GList *file_list = NULL; |
| 2718 | char *s; |
| 2719 | |
| 2720 | /* open file with positions */ |
| 2721 | fn = g_build_filename (home_dir, MC_USERCONF_DIR, MC_FILEPOS_FILE, NULL); |
| 2722 | f = fopen (fn, "r"); |
| 2723 | g_free (fn); |
| 2724 | if (f == NULL) |
| 2725 | return; |
| 2726 | |
| 2727 | while (fgets (buf, sizeof (buf), f) != NULL) |
| 2728 | { |
| 2729 | s = strchr(buf, ' '); |
| 2730 | if (s) |
| 2731 | { |
| 2732 | *s = 0; |
| 2733 | } |
| 2734 | s = g_strdup (buf); |
| 2735 | |
| 2736 | file_list = g_list_prepend (file_list, s); |
| 2737 | file_list = g_list_first(file_list); |
| 2738 | } |
| 2739 | fclose(f); |
| 2740 | |
| 2741 | file_list = g_list_last(file_list); |
| 2742 | s = history_show (&file_list, &panel->widget); |
| 2743 | |
| 2744 | if (s != NULL) |
| 2745 | { |
| 2746 | char *s_copy = g_strdup (s); |
| 2747 | do_cd(dirname(s_copy), cd_exact); |
| 2748 | try_to_select (panel, basename(s)); |
| 2749 | g_free(s_copy); |
| 2750 | } |
| 2751 | file_list = g_list_first (file_list); |
| 2752 | g_list_foreach (file_list, (GFunc) g_free, NULL); |
| 2753 | g_list_free (file_list); |