lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev Update for djgpp + _fmode


From: dickey
Subject: Re: lynx-dev Update for djgpp + _fmode
Date: Mon, 21 Sep 1998 14:51:17 -0400 (EDT)

> 
> In the never-ending quest for reducing ifdef clutter in Lynx, here's 
> my patches. I've defined a macro in LYcurses.h for setting _fmode as 
> needed. 
I suppose -- but what's wrong with making a macro that evaluates to an
empty string?  (I know of compilers and lint programs that warn about the 
"(void)0;" statements, but none that complain about an empty ":".
  
(if it's not fixing a bug, though, we can hold off til 2.8.2 development - I've
4-5 patches in my queue for that)

> Diff format is `diff -B -H -u3'. Files *.?~ are files patched against files 
> from 2.8.1dev29. 
>  
>  
> --- lycurses.h~ Sun Sep 13 13:35:54 1998 
> +++ lycurses.h  Mon Sep 21 13:35:06 1998 
> @@ -396,10 +396,12 @@ 
>   * stdout in BINARY mode by default.  Where necessary we should open and 
>   * (close!) TEXT mode. 
>   */ 
> -#if defined(_WINDOWS) || defined(DJGPP) 
> -#define SetOutputMode(mode) setmode(fileno(stdout), mode) 
> +#if defined(_WINDOWS) || defined(__DJGPP__) 
> +  #define SetOutputMode(mode)  setmode(fileno(stdout), mode) 
> +  #define SetFmode(mode)       _fmode = mode 
>  #else 
> -#define SetOutputMode(mode) /* nothing */ 
> +  #define SetOutputMode(mode)  ((void)0) 
> +  #define SetFmode(mode)       ((void)0) 
>  #endif 
>   
>  #endif /* LYCURSES_H */ 
>  
>  
> --- lymain.c~   Mon Sep 21 01:33:18 1998 
> +++ lymain.c  Mon Sep 21 13:41:38 1998 
> @@ -550,15 +550,8 @@ 
>      sock_init(); 
>  #endif 
>   
> -#if defined(_WINDOWS) || defined(DJGPP) 
> -    /* 
> -     * To prevent corrupting binary data with _WINDOWS and DJGPP 
> -     * we open files and stdout in BINARY mode by default. 
> -     * Where necessary we should open and (close!) TEXT mode. 
> -     */ 
> -    _fmode = O_BINARY; 
> -    SetOutputMode( O_BINARY ); 
> -#endif 
> +    SetFmode(O_BINARY); 
> +    SetOutputMode(O_BINARY); 
>   
>  #ifdef DOSPATH 
>      if (getenv("TERM")==NULL) putenv("TERM=vt100"); 
> @@ -1011,9 +1004,7 @@ 
>      LYAddPathToHome(LYTraceLogPath = malloc(LY_MAXPATH), LY_MAXPATH, 
> "Lynx.trace"); 
>   
>      if (TRACE && LYUseTraceLog) { 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -     _fmode = O_TEXT; 
> -#endif /* __DJGPP__  or _WINDOWS */ 
> +        SetFmode(O_TEXT); 
>   
>       /* 
>        *  If we can't open it for writing, give up. 
> @@ -1025,9 +1016,7 @@ 
>           WWW_TraceFlag = FALSE; 
>           fprintf(stderr, "%s\n", TRACELOG_OPEN_FAILED); 
>   
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -         _fmode = O_BINARY; 
> -#endif /* __DJGPP__ or _WINDOWS */ 
> +            SetFmode(O_BINARY); 
>           exit(-1); 
>       } 
>  #ifdef VMS 
>  
>  
> --- lybookma.c~       Mon Sep 21 01:33:18 1998 
> +++ lybookma.c        Mon Sep 21 13:39:50 1998 
> @@ -291,9 +291,8 @@ 
>       *       Create the bookmark file, if it doesn't exist already, 
>       *       Otherwise, open the pre-existing bookmark file. - FM 
>       */ 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -     _fmode = O_TEXT; 
> -#endif /* __DJGPP__  or _WINDOWS */ 
> +    SetFmode (O_TEXT); 
> + 
>      if (first_time) { 
>       /* 
>        *  Seek it in the home path. - FM 
> @@ -354,10 +353,7 @@ 
>       fprintf(fp,"<LI><a href=\"%s\">%s</a>\n", Address, Title); 
>      } 
>      fclose(fp); 
> - 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -    _fmode = O_BINARY; 
> -#endif /* __DJGPP__ or _WINDOWS */ 
> +    SetFmode(O_BINARY); 
>      /* 
>       *       If this is a cached bookmark file, set nocache for 
>       *       it so we'll see the new bookmark link when that 
>  
>  
> --- lyprint.c~  Mon Sep 21 01:33:18 1998 
> +++ lyprint.c Mon Sep 21 13:38:20 1998 
> @@ -244,9 +244,7 @@ 
>       */ 
>      switch (type) { 
>       case TO_FILE: 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -             _fmode = O_TEXT; 
> -#endif /* __DJGPP__  or _WINDOWS */ 
> +                SetFmode (O_TEXT); 
>               _statusline(FILENAME_PROMPT); 
>       retry:  strcpy(filename, sug_filename);  /* add suggestion info */ 
>               /* make the sug_filename conform to system specs */ 
> @@ -529,9 +527,7 @@ 
>  #else 
>               HTAddSugFilename(buffer); 
>  #endif /* VMS */ 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -             _fmode = O_BINARY; 
> -#endif /* __DJGPP__ or _WINDOWS */ 
> +                SetFmode (O_BINARY); 
>               break; 
>   
>       case MAIL: 
>  
>  
> --- lyrcfile.c~       Thu Sep 17 09:43:48 1998 
> +++ lyrcfile.c        Mon Sep 21 13:37:14 1998 
> @@ -7,6 +7,7 @@ 
>  #include <LYCharSets.h> 
>  #include <LYBookmark.h> 
>  #include <LYCookie.h> 
> +#include <LYCurses.h> 
>   
>  #include <LYLeaks.h> 
>   
> @@ -559,9 +560,7 @@ 
>      /* 
>       *  Open the file for write. 
>       */ 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -    _fmode = O_TEXT; 
> -#endif /* __DJGPP__  or _WINDOWS */ 
> +    SetFmode (O_TEXT); 
>      if ((fp = LYNewTxtFile(rcfile)) == NULL) { 
>       return FALSE; 
>      } 
> @@ -980,9 +979,7 @@ 
>       *  Close the RC file. 
>       */ 
>      fclose(fp); 
> -#if defined(__DJGPP__) || defined(_WINDOWS) 
> -    _fmode = O_BINARY; 
> -#endif /* __DJGPP__ or _WINDOWS */ 
> +    SetFmode (O_BINARY); 
>   
>  #ifdef VMS 
>      /* 
>  
> --------------------------------------------------------------- 
>  
> Gisle V. 


-- 
Thomas E. Dickey
address@hidden
http://www.clark.net/pub/dickey

reply via email to

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