home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume14 / pc2unix / patch01 < prev    next >
Encoding:
Text File  |  1990-07-15  |  2.0 KB  |  68 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v14i008: Patch for pc2unix
  3. From: magnus@thep.lu.se (Magnus Olsson)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 8
  7. Submitted-by: magnus@thep.lu.se (Magnus Olsson)
  8. Archive-name: pc2unix/patch01
  9.  
  10. There is a bug (or perhaps rather a misfeature) in pc2unix.c: If the input file
  11. doesn't have a EOF marker (ASCII 26), it includes an extra ASCII 255 in the
  12. output. Below is a patch to correct this (apply by extracting pc2unix.patch and 
  13. then doing patch <pc2unix.patch). Hope this hasn't caused too much inconvenience.
  14.  
  15. Magnus
  16.  
  17. ----------- Cut here ------------------
  18. #!/bin/sh
  19. # shar:    Shell Archiver  (v1.22)
  20. #
  21. #    Run the following text with /bin/sh to create:
  22. #      pc2unix.patch
  23. #
  24. sed 's/^X//' << 'SHAR_EOF' > pc2unix.patch &&
  25. X*** old.pc2unix.c    Fri Jul 13 12:13:35 1990
  26. X--- pc2unix.c    Fri Jul 13 12:13:35 1990
  27. X***************
  28. X*** 10,15 ****
  29. X--- 10,16 ----
  30. X   ***            Written by         ***
  31. X   *** Magnus Olsson (magnus@thep.lu.se)    ***
  32. X   ***          July 11, 1990        ***
  33. X+  ***      Patch #1  July 13, 1990       ***
  34. X   ******************************************/
  35. X  
  36. X  /* 
  37. X***************
  38. X*** 84,95 ****
  39. X      FILE *f;
  40. X  
  41. X  {
  42. X!     unsigned char ch; /* Must be unsigned to handle extended ASCII codes */
  43. X         
  44. X      ch = 0; 
  45. X      while (ch != CTRL_Z && ! feof (f)) {
  46. X!         ch = getc (f);
  47. X!         if (ch != CR && ch != CTRL_Z) {
  48. X          if (! pass_ctrl && ch < ' ' && ch != LF && ch != TAB) 
  49. X           printf ("^%c",ch + 'A' - 1);
  50. X          else if (! pass_ext && ch > 126) 
  51. X--- 85,96 ----
  52. X      FILE *f;
  53. X  
  54. X  {
  55. X!     int ch;
  56. X         
  57. X      ch = 0; 
  58. X      while (ch != CTRL_Z && ! feof (f)) {
  59. X!         ch = getc (f); 
  60. X!         if (ch >= 0 && ch != CR && ch != CTRL_Z) {
  61. X          if (! pass_ctrl && ch < ' ' && ch != LF && ch != TAB) 
  62. X           printf ("^%c",ch + 'A' - 1);
  63. X          else if (! pass_ext && ch > 126) 
  64. SHAR_EOF
  65. chmod 0644 pc2unix.patch || echo "restore of pc2unix.patch fails"
  66. exit 0
  67.  
  68.