lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] Small patches for lynx2.8.9dev.16


From: Juan Manuel Guerrero
Subject: Re: [Lynx-dev] Small patches for lynx2.8.9dev.16
Date: Mon, 28 Aug 2017 22:56:20 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7

Am 28.08.2017 18:00, schrieb Takeshi Hataguchi:
Thanks for your useful comment.
I agree with your comment regarding DOS like file systems.

bug produced when the coding is posix centric.  It remains unclear
to me why stat is used instead of access.  Something like:
   access(dst, F_OK) != 0
is faster than having to compute stat for a file on windows or dos
AFAIK.  Do not get me wrong, for this application it will not really
matter.

On the other hand, I'm not sure which function we should use for checking file 
existence.
According to the following site, access() is used in "Compliant Solution (POSIX)", but 
_access_s() is used in "Compliant Solution (Windows)."  There seems to be some reason not 
to use access() on Windows.
https://www.securecoding.cert.org/confluence/display/c/FIO10-C.+Take+care+when+using+the+rename%28%29+function

So I decided not to use access(), but it's not a strong opinion.

Thanks,

Takeshi Hataguchi

Thanks for you replay.  One small issue more.  I have applied all the
patches proposed by you and compiled the source code using DJGPP.
That is a port of GCC to MSDOS/FreeDOS and I got the following error message:

[snip]
gcc -DHAVE_CONFIG_H  -DLOCALEDIR=\"/dev/env/DJDIR/share/locale\" -I. -I.. 
-Ichrtrans -I.././../src/chrtrans -I.././.. -I.././../src 
-I.././.././WWW/Library/Implementation    -I/dev/env/WATT_ROOT/inc -D_XOPEN_SOURCE=500 
-D_POSIX_C_SOURCE=199506L -DDOSPATH -DNOUSERS -I/dev/env/DJDIR/lib/../include 
-I/dev/env/DJDIR/include -g2 -O2 -fgnu89-inline -march=i386 -mtune=i586 -save-temps  -c 
.././../src/LYCurses.c
.././../src/LYCurses.c: In function 'start_curses':
.././../src/LYCurses.c:1549:2: warning: implicit declaration of function 
'resize_term_WinPDC'; did you mean 'resize_term'? 
[-Wimplicit-function-declaration]
  resize_term_WinPDC(scrsize_y, scrsize_x);
  ^~~~~~~~~~~~~~~~~~
  resize_term
[snip]
Linking and creating Lynx executable
gcc -DHAVE_CONFIG_H  -DLOCALEDIR=\"/dev/env/DJDIR/share/locale\" -I. -I.. 
-Ichrtrans -I.././../src/chrtrans -I.././.. -I.././../src 
-I.././.././WWW/Library/Implementation    -I/dev/env/WATT_ROOT/inc -D_XOPEN_SOURCE=500 
-D_POSIX_C_SOURCE=199506L -DDOSPATH -DNOUSERS -I/dev/env/DJDIR/lib/../include 
-I/dev/env/DJDIR/include -g2 -O2 -fgnu89-inline -march=i386 -mtune=i586 -save-temps  
-L/dev/env/DJDIR/lib  -o lynx.exe  LYebcdic.o LYClean.o LYShowInfo.o LYEdit.o LYStrings.o 
LYMail.o HTAlert.o GridText.o LYGetFile.o LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o 
LYmktime.o LYUtils.o LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o LYForms.o LYPrint.o 
LYrcFile.o LYDownload.o LYNews.o LYKeymap.o HTML.o HTFWriter.o HTInit.o DefaultStyle.o 
LYUpload.o LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o LYEditmap.o 
LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o 
parsdate.o UCdomap.o UCAux.o UCAuto.o  LYSession.o LYExtern.o LYLocal.o  .././WWW/L
ibrary/Implementation/libwww.a -lz -lbz2 -lpdcurses -L/dev/env/WATT_ROOT/lib -lssl -lcrypto -lwatt -lz
LYCurses.o: In function `start_curses':
l:/_/lynx2.8.9dev.16/_/src/.././../src/LYCurses.c:1549: undefined reference to 
`resize_term_WinPDC'
collect2.exe: error: ld returned 1 exit status
make.exe[1]: *** [Makefile:111: lynx.exe] Error 1
make.exe[1]: Leaving directory 'l:/_/lynx2.8.9dev.16/_/src'
make.exe: *** [Makefile:221: all] Error 2

The issue is that resize_term_WinPDC is compiled also by some compilers
that are not windows compilers.  I would suggest a small modification
like the patch below.  After this change everthing compiled and
worked flawlessly for me.

Regards,
Juan M. Guerrero




diff -aprNU5 lynx2.8.9dev.16.orig/src/LYCurses.c lynx2.8.9dev.16/src/LYCurses.c
--- lynx2.8.9dev.16.orig/src/LYCurses.c 2017-08-27 01:12:12 +0000
+++ lynx2.8.9dev.16/src/LYCurses.c      2017-08-28 22:25:58 +0000
@@ -974,10 +974,11 @@ int saved_winpos_y2 = 0;

 #ifdef USE_MAXSCREEN_TOGGLE
 static HWND currentWindowHandle = NULL;
 static char dummyWindowTitle[256];

+#ifdef _WINDOWS
 int resize_term_WinPDC(int nlines, int ncols)
 {
     HANDLE hConsole;
     CONSOLE_SCREEN_BUFFER_INFO csbi;
     SMALL_RECT srWindowRect;
@@ -988,10 +989,11 @@ int resize_term_WinPDC(int nlines, int n
     srWindowRect.Bottom = min(nlines, csbi.dwSize.Y) - 1;
     srWindowRect.Left   = srWindowRect.Top = (SHORT)0;
     SetConsoleWindowInfo( hConsole, TRUE, &srWindowRect);
     return resize_term(nlines, ncols);
 }
+#endif

 static int CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
 {
     char this_title[256];

@@ -1544,11 +1546,13 @@ void start_curses(void)
            saved_scrsize_x = COLS;
            saved_scrsize_y = LINES + 1;
        }
        CTRACE((tfp, "resize_term: x=%d, y=%d\n", scrsize_x, scrsize_y));
        CTRACE((tfp, "saved terminal size: x=%d, y=%d\n", saved_scrsize_x, 
saved_scrsize_y));
+#ifdef _WINDOWS
        resize_term_WinPDC(scrsize_y, scrsize_x);
+#endif
        LYlines = LYscreenHeight();
        LYcols = LYscreenWidth();
        LYStatusLine = -1;
        LYclear();
 #ifdef _WINDOWS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]