Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. diff -rc2 ./fileio.c e:fileio.c
  2. *** ./fileio.c  Sat Dec  4 19:58:26 1999
  3. --- e:fileio.c  Sat Dec  4 20:54:10 1999
  4. ***************
  5. *** 85,88 ****
  6. --- 85,91 ----
  7.      (win_fprintf(pG, strm, (extent)len, (char far *)buf) != (int)(len))
  8.   #else /* !WINDLL */
  9. + #ifdef NLM
  10. + #  define WriteError(buf,len,strm) nlm_WriteError(buf, (extent)(len), strm)
  11. + #else /* !NLM */
  12.   #  ifdef USE_FWRITE
  13.   #    define WriteError(buf,len,strm) \
  14. ***************
  15. *** 92,95 ****
  16. --- 95,99 ----
  17.        ((extent)write(fileno(strm),(char *)(buf),(extent)(len)) != (extent)(len))
  18.   #  endif
  19. + #endif /* ?NLM */
  20.   #endif /* ?WINDLL */
  21.  
  22. diff -rc2 ./netware/nlmcfg.h e:netware/nlmcfg.h
  23. *** ./netware/nlmcfg.h  Sat Dec  4 20:39:20 1999
  24. --- e:netware/nlmcfg.h  Sat Dec  4 21:20:36 1999
  25. ***************
  26. *** 21,25 ****
  27.   #  define lenEOL          2
  28.   #  define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
  29. - #  define USE_FWRITE    /* write() fails to support textmode output */
  30.   #  if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
  31.   #    define TIMESTAMP
  32. --- 21,24 ----
  33. ***************
  34. *** 30,32 ****
  35. --- 29,32 ----
  36.      void InitUnZipConsole OF((void));
  37.      int screenlines       OF((void));
  38. +    int nlm_WriteError    OF((uch *buf, extent len, FILE *strm));
  39.   #endif /* NLM */
  40. diff -rc2 ./netware/netware.c e:netware/netware.c
  41. *** ./netware/netware.c Sat Dec  4 21:11:52 1999
  42. --- e:netware/netware.c Sat Dec  4 21:28:38 1999
  43. ***************
  44. *** 22,25 ****
  45. --- 22,26 ----
  46.                version()
  47.                screenlines()
  48. +              nlm_WriteError()
  49.  
  50.     ---------------------------------------------------------------------------*/
  51. ***************
  52. *** 821,822 ****
  53. --- 822,850 ----
  54.  
  55.   #endif /* MORE */
  56. +
  57. +
  58. + /*******************************/
  59. + /*  Function nlm_WriteError()  */
  60. + /*******************************/
  61. +
  62. + int nlm_WriteError(buf, len, strm)
  63. +     uch *buf;
  64. +     extent len;
  65. +     FILE *strm;
  66. + {
  67. +     /* The write() implementation in the Novell C RTL lacks support of
  68. +        text-mode streams (fails to translate '\n' into "CR-LF" when
  69. +        writing to text-mode channels like the console).
  70. +        In contrast, fwrite() takes into account when an output stream
  71. +        was opened in text-mode, but fails to handle output of large
  72. +        buffers correctly.
  73. +        So, we have to use Unix I/O style write() when emitting data
  74. +        to "regular" files but switch over to stdio's fwrite() when
  75. +        writing to the console streams.
  76. +      */
  77. +     if ((strm == stdout)) || (file == stderr)) {
  78. +          return ((extent)fwrite((char *)buf, 1, len, strm) != len);
  79. +     } else {
  80. +          return ((extent)write(fileno(strm), (char *)buf, len) != len);
  81. +     }
  82. + } /* end function nlm_WriteError() */
  83.