From: H.G. Muller Date: Thu, 7 Jan 2010 16:31:48 +0000 (+0100) Subject: Fix warnings from Ghostview file-browser dialog X-Git-Tag: hgm-4.20100107~3 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=a2e4fb5b6743a0b7c965a6282dca0ddf9518c14d Fix warnings from Ghostview file-browser dialog The Ghostview dialog was using some deprecated variables for error printing, and conditionally used getwd() on some systems that presumably do not have getcwd(), but it did not assess the latter properly. --- diff --git a/selfile.c b/selfile.c index 422cf7b..4298e30 100644 --- a/selfile.c +++ b/selfile.c @@ -45,7 +45,7 @@ #include /* BSD 4.3 errno.h does not declare errno */ extern int errno; -extern int sys_nerr; +//extern int sys_nerr; //extern char *sys_errlist[]; // [HGM] this produced a compile error in Ubuntu 8.04 #include @@ -567,11 +567,11 @@ SFopenFile(name, mode, prompt, failed) SFchdir(SFstartDir); if ((fp = fopen(name, mode)) == NULL) { char *buf; - if (errno <= sys_nerr) { - buf = XtMalloc(strlen(failed) + strlen(sys_errlist[errno]) + + if (1) { // [HGM] always use strerror + buf = XtMalloc(strlen(failed) + strlen(strerror(errno)) + strlen(prompt) + 2); strcpy(buf, failed); - strcat(buf, sys_errlist[errno]); + strcat(buf, strerror(errno)); strcat(buf, "\n"); strcat(buf, prompt); } else { @@ -685,8 +685,8 @@ XsraSelFile(toplevel, prompt, ok, cancel, failed, SFpositionWidget(selFile); XtMapWidget(selFile); -#if defined(SVR4) || defined(SYSV) || defined(USG) - if (!getcwd(SFstartDir, MAXPATHLEN)) { +#if defined(SVR4) || defined(SYSV) || defined(USG) || 1 + if (!getcwd(SFstartDir, MAXPATHLEN)) { // [HGM] always do this, as I do not know when exactly to do it #else /* defined(SVR4) || defined(SYSV) || defined(USG) */ if (!getwd(SFstartDir)) { #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */