From 113b1c5fe5176065ad643448039e945b5fd93c99 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Tue, 18 Feb 1997 14:26:24 +0000 Subject: [PATCH] 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" & me --- gnu/lib/libdialog/fselect.c | 6 ++++-- gnu/lib/libdialog/ui_objects.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gnu/lib/libdialog/fselect.c b/gnu/lib/libdialog/fselect.c index 4a8d0751be44..6669edc529b2 100644 --- a/gnu/lib/libdialog/fselect.c +++ b/gnu/lib/libdialog/fselect.c @@ -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); } diff --git a/gnu/lib/libdialog/ui_objects.c b/gnu/lib/libdialog/ui_objects.c index 8c178c69c6c4..dde151344a72 100644 --- a/gnu/lib/libdialog/ui_objects.c +++ b/gnu/lib/libdialog/ui_objects.c @@ -803,6 +803,7 @@ SelectButtonObj(ButtonObj *bo) case ctrl('b'): return(SEL_BACKTAB); case '\n': + case '\r': *(bo->pushed) = TRUE; return(SEL_BUTTON); break;