🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael Wescott Thu, 10 Jul 1986 20:03
bug report and patch for newform(1)
#323
Author: Michael Wescott
Date: Thu, 10 Jul 1986 20:03
95 lines
3067 bytes
The newform command does not expand tabs properly beyond column 80 with either
the default specs or with the -8 (or some other number) spec.

For example:
	echo "\t1\t2\t3\t4\t5\t6\t7\t8\t9\tA\tB\tC" | newform -i 
produces:
        1       2       3       4       5       6       7       8       9ABC
and
	echo "\t1\t2\t3\t4\t5\t6\t7\t8\t9\tA\tB\tC" | newform -i-9
gives:
         1        2        3        4        5        6        7        89ABC

patch follows which fixes problems and sets up a sufficiently large tabtbl for
the worst case (I think).

Your line numbers may differ...

*** newform.c.orig	Thu Jul 10 15:37:27 1986
--- newform.c	Thu Jul 10 15:45:29 1986
***************
*** 33,39
  #define	NCOLS	512
  #define	MAXLINE	512
  #define	NUMBER	'0'
- #define	LINELEN	80
  
  int	tabtbl[500] = {		/* Table containing tab stops		*/
  	1,9,17,25,33,41,49,57,65,73,0,

--- 33,38 -----
  #define	NCOLS	512
  #define	MAXLINE	512
  #define	NUMBER	'0'
  
  int	tabtbl[MAXLINE*2+2+87] = {		/* Table containing tab stops		*/
  	1,9,17,25,33,41,49,57,65,73,0,
***************
*** 35,41
  #define	NUMBER	'0'
  #define	LINELEN	80
  
! int	tabtbl[500] = {		/* Table containing tab stops		*/
  	1,9,17,25,33,41,49,57,65,73,0,
  				/* Default tabs				*/
  	1,10,16,36,72,0,	/* IBM 370 Assembler			*/

--- 34,40 -----
  #define	MAXLINE	512
  #define	NUMBER	'0'
  
! int	tabtbl[MAXLINE*2+2+87] = {		/* Table containing tab stops		*/
  	1,9,17,25,33,41,49,57,65,73,0,
  				/* Default tabs				*/
  	1,10,16,36,72,0,	/* IBM 370 Assembler			*/
***************
*** 258,264
  		case 0:
  			switch (type(c)) {
  			case '\0':
! 				spectype = 0;
  				state = -1;
  				break;
  			case NUMBER:

--- 257,264 -----
  		case 0:
  			switch (type(c)) {
  			case '\0':
! 				number[0] = 8;
! 				spectype = 10;
  				state = -1;
  				break;
  			case NUMBER:
***************
*** 443,449
  		spectbl[spectype] = nexttab;
  		*nexttab = 1;
  	 	if(number[0] == 0)number[0] = 1; /* Prevent infinite loop. */
! 		while (*nexttab < LINELEN) {
  			*(nexttab + 1) = *nexttab;
  			*++nexttab += number[0];
  			}

--- 443,449 -----
  		spectbl[spectype] = nexttab;
  		*nexttab = 1;
  	 	if(number[0] == 0)number[0] = 1; /* Prevent infinite loop. */
! 		while (*nexttab < MAXLINE) {
  			*(nexttab + 1) = *nexttab;
  			*++nexttab += number[0];
  			}


	-Mike Wescott
	ncrcae!wescott
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