From: H.G. Muller Date: Thu, 5 Dec 2013 15:23:53 +0000 (+0100) Subject: Fix Xaw file-browser New Directory X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a01943bb611a77eabd7ab7539f2d9458854087bd;p=xboard.git Fix Xaw file-browser New Directory Prevent people from using the error messages that will be printed here as directory name by pressing New Directory a second time after first pressing it with an empty or existing name. --- diff --git a/dialogs.c b/dialogs.c index 6bb83f1..ad164ce 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2487,13 +2487,17 @@ Refresh (int pathFlag) SetWidgetLabel(&browseOptions[0], title); } +static char msg1[] = N_("FIRST TYPE DIRECTORY NAME HERE"); +static char msg2[] = N_("TRY ANOTHER NAME"); + void CreateDir (int n) { char *name, *errmsg = ""; GetWidgetText(&browseOptions[n-1], &name); - if(!name[0]) errmsg = _("FIRST TYPE DIRECTORY NAME HERE"); else - if(mkdir(name, 0755)) errmsg = _("TRY ANOTHER NAME"); + if(!strcmp(name, msg1) || !strcmp(name, msg2)) return; + if(!name[0]) errmsg = _(msg1); else + if(mkdir(name, 0755)) errmsg = _(msg2); else { chdir(name); Refresh(-1);