🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by barryg Fri, 22 Jul 1983 17:05
dd - EBCDIC to ASCII translation error
#127
Author: barryg
Date: Fri, 22 Jul 1983 17:05
105 lines
3965 bytes
There is a bug in the EBCDIC to ASCII translation in dd.
I earlier submitted an alternative version of the etoa translation table,
but decided that the user should have a choice of translation tables -
either the one that comes with the standard dd, or the one I built that
is compatible with the IBM TN print train.

conv=ascii selects the standard translation, and
conv=tnascii selects the translation table I built.
The following is the result of running diff, comparing the standard source
(4.1bsd) with my source.  My source will be posted to net.sources.

barry gold

diff /usr/src/cmd/dd.c ~/dd.c > dd.diff


1c1
< static char *sccsid = "@(#)dd.c	4.1 (Berkeley) 10/1/80";
---
> static char *sccsid = "@(#)dd.c       4.1.a (Barry Gold) 7/22/83";
72a73,115
> char    etoatn[] = {
>        /*NUL  SOH  STX  ETX       HT       DEL*/
>  /*00*/	0000,0001,0002,0003,0234,'\t',0206,0177,
> 		      /* VT  FF   CR   SO   SI*/
> 	0227,0215,0216,0013,'\f','\r',0016,0017,
>        /*DLE  DC1  DC2  DC3       NL   BS*/
>  /*10*/	0020,0021,0022,0023,0235,'\n','\b',0207,
>        /* EM  SUB             FS   GS   RS  US*/
> 	0030,0031,0222,0217,0034,0035,0036,0037,
> 				/*LF   ETB ESC*/
>  /*20*/	0200,0201,0202,0203,0204,'\n',0027,0033,
> 				/*ENQ  ACK  BEL*/
> 	0210,0211,0212,0213,0214,0005,0006,0007,
> 		/* SYN 			   EOT*/
>  /*30*/	0220,0221,0026,0223,0224,0225,0226,0004,
> 			  /* DC4  NAK      SUB*/
> 	0230,0231,0232,0233,0024,0025,0236,0032,
>  /*40*/  ' ',0240,0241,0242,0243,0244,0245,0246,
> 		/*cent*/                          /*4a (cent) ==> [ */
> 	0247,0250, '[', '.', '<', '(', '+', '^',
>  /*50*/	 '&',0251,0252,0253,0254,0255,0256,0257,
> 	0260,0261, '!', '$', '*', ')', ';', '~',
>  /*60*/	 '-', '/',0262,0263,0264,0265,0266,0267,
> 	0270,0271, '|', ',', '%', '_', '>', '?',
>  /*70*/	0272,0273,0274,0275,0276,0277,0300,0301,
> 	0302, '`', ':', '#', '@','\'', '=','\"',
>  /*80*/	0303, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
> 	 'h', 'i',0304,0305,0306,0307,0310,0311,
>  /*90*/	0312, 'j', 'k', 'l', 'm', 'n', 'o', 'p',
> 	 'q', 'r',0313,0314,0315,0316,0317,0320,
>  /*A0*/	0321, '~', 's', 't', 'u', 'v', 'w', 'x',
> 	 'y', 'z',0322,0324,0325, '[',0326,0327,  /*AD = [*/
>  /*B0*/	0330,0331,0332,0333,0334,0335,0336,0337,
> 	0340,0341,0342,0344,0345, ']',0346,0347,  /*BD = ]*/
>  /*C0*/	 '{', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
> 	 'H', 'I',0350,0351,0352,0353,0354,0355,
>  /*D0*/	 '}', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
> 	 'Q', 'R',0356,0357,0360,0361,0362,0363,
>  /*E0*/	'\\',0237, 'S', 'T', 'U', 'V', 'W', 'X',
> 	 'Y', 'Z',0364,0365,0366,0367,0370,0371,
>  /*F0*/	 '0', '1', '2', '3', '4', '5', '6', '7',
> 	 '8', '9',0372,0373,0374,0375,0376,0377,
> };
151c194,195
< 	int ebcdic(), ibm(), ascii(), null(), cnull(), term(), block(), unblock();
---
> 	int ebcdic(), ibm(), ascii(), tnascii(), null(), cnull(), term(),
> 		block(), unblock();
214a259,262
> 			if(match("tnascii")) {
> 				conv = tnascii;
> 				goto cloop;
> 			}
477a526,552
> tnascii(cc)
> {
> 	register c;
> 
> 	c = etoatn[cc] & 0377;
> 	if(cbs == 0) {
> 		cnull(c);
> 		return;
> 	}
> 	if(c == ' ') {
> 		nspace++;
> 		goto out;
> 	}
> 	while(nspace > 0) {
> 		null(' ');
> 		nspace--;
> 	}
> 	cnull(c);
> 
> out:
> 	if(++cbc >= cbs) {
> 		null('\n');
> 		cbc = 0;
> 		nspace = 0;
> 	}
> }
> 
606a682,683
> 
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads