When wrong directory choosed and chdir failed, directory name

was not reset to old name causing any file choosen put error
diagnostic about wrong directory, fix it by resetting back
to old name after chdir failed.

Add \r as alias to \n, some telnets have problem with that.

Should go into 2.2
Submitted by: "Anatoly A. Orehovsky" <tolik@mpeks.tomsk.su> & me
This commit is contained in:
Andrey A. Chernov 1997-02-18 14:26:24 +00:00
parent 697030ed3d
commit 113b1c5fe5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=22879
2 changed files with 5 additions and 2 deletions

View File

@ -171,11 +171,12 @@ dialog_dselect_old(void)
/* the directory was changed, cd into it */
if (chdir(o_dir)) {
dialog_notify("Could not change into directory");
strcpy(o_dir, old_dir);
} else {
getcwd(o_dir, MAXPATHLEN);
strcpy(old_dir, o_dir);
RefreshStringObj(dir_obj);
}
RefreshStringObj(dir_obj);
}
get_dir(".", "*", &d, &n);
FreeNames(names, nd);
@ -344,11 +345,12 @@ dialog_dfselect(char *dir, char *fmask, int is_fselect)
if (strcmp(old_dir, o_dir)) { /* dir entry was changed */
if (chdir(o_dir)) {
dialog_notify("Could not change into directory");
strcpy(o_dir, old_dir);
} else {
getcwd(o_dir, MAXPATHLEN);
strcpy(old_dir, o_dir);
RefreshStringObj(dir_obj);
}
RefreshStringObj(dir_obj);
} else { /* fmask entry was changed */
strcpy(old_fmask, o_fm);
}

View File

@ -803,6 +803,7 @@ SelectButtonObj(ButtonObj *bo)
case ctrl('b'):
return(SEL_BACKTAB);
case '\n':
case '\r':
*(bo->pushed) = TRUE;
return(SEL_BUTTON);
break;