*** original/user.c Thu Jan 22 18:07:20 2004 --- user.c Thu Jan 22 23:58:47 2004 *************** *** 551,560 **** --- 551,561 ---- int do_quote = 0; char prompt [80]; int col; char *file_name; int run_view = 0; + int change_dir = 0; /* david: change */ /* Skip menu entry title line */ commands = strchr (commands, '\n'); if (!commands){ return; *************** *** 625,636 **** int i = check_format_view (commands + 1); if (i) { commands += i; run_view = 1; } else { ! do_quote = 1; /* Default: Quote expanded macro */ ! expand_prefix_found = 1; } } else fputc (*commands, cmd_file); } } --- 626,646 ---- int i = check_format_view (commands + 1); if (i) { commands += i; run_view = 1; } else { ! i = check_format_cd (commands + 1); /* david: begin change */ ! if (i) ! { ! commands += i; ! change_dir = 1; ! } /* david: end change */ ! else ! { ! do_quote = 1; /* Default: Quote expanded macro */ ! expand_prefix_found = 1; ! } } } else fputc (*commands, cmd_file); } } *************** *** 642,651 **** --- 652,676 ---- } else { shell_execute (file_name, 0); } unlink (file_name); g_free (file_name); + + if (change_dir) /* david: begin change */ + { + char buffer[256] = ""; + sprintf (buffer, "%s/.mc_cdfile", home_dir); + FILE *dir_file = fopen (buffer, "r"); + if (dir_file) + { + if (fscanf (dir_file, "%255[^\n]s", buffer) == 1) + { + do_cd (buffer, cd_exact); + } + } + fclose (dir_file); + } /* david: end change */ } /* ** Check owner of the menu file. Using menu file is allowed, if ** owner of the menu is root or the actual user. In either case