magnus@thep.lu.se (Magnus Olsson) (07/16/90)
Posting-number: Volume 14, Issue 8 Submitted-by: magnus@thep.lu.se (Magnus Olsson) Archive-name: pc2unix/patch01 There is a bug (or perhaps rather a misfeature) in pc2unix.c: If the input file doesn't have a EOF marker (ASCII 26), it includes an extra ASCII 255 in the output. Below is a patch to correct this (apply by extracting pc2unix.patch and then doing patch <pc2unix.patch). Hope this hasn't caused too much inconvenience. Magnus ----------- Cut here ------------------ #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # pc2unix.patch # sed 's/^X//' << 'SHAR_EOF' > pc2unix.patch && X*** old.pc2unix.c Fri Jul 13 12:13:35 1990 X--- pc2unix.c Fri Jul 13 12:13:35 1990 X*************** X*** 10,15 **** X--- 10,16 ---- X *** Written by *** X *** Magnus Olsson (magnus@thep.lu.se) *** X *** July 11, 1990 *** X+ *** Patch #1 July 13, 1990 *** X ******************************************/ X X /* X*************** X*** 84,95 **** X FILE *f; X X { X! unsigned char ch; /* Must be unsigned to handle extended ASCII codes */ X X ch = 0; X while (ch != CTRL_Z && ! feof (f)) { X! ch = getc (f); X! if (ch != CR && ch != CTRL_Z) { X if (! pass_ctrl && ch < ' ' && ch != LF && ch != TAB) X printf ("^%c",ch + 'A' - 1); X else if (! pass_ext && ch > 126) X--- 85,96 ---- X FILE *f; X X { X! int ch; X X ch = 0; X while (ch != CTRL_Z && ! feof (f)) { X! ch = getc (f); X! if (ch >= 0 && ch != CR && ch != CTRL_Z) { X if (! pass_ctrl && ch < ' ' && ch != LF && ch != TAB) X printf ("^%c",ch + 'A' - 1); X else if (! pass_ext && ch > 126) SHAR_EOF chmod 0644 pc2unix.patch || echo "restore of pc2unix.patch fails" exit 0