nlm_EOL.pat 2.7 KB

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