🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Rick Farnbach Fri, 28 Aug 1992 22:13
indent-1.6: Patch to add --dont-use-tabs feature for output
#679
Author: Rick Farnbach
Date: Fri, 28 Aug 1992 22:13
115 lines
3668 bytes
The enclosed patch adds the following switches:
  -ut, --use-tabs
  -nut, --dont-use-tabs

Also, in looking over the code, I notice that tabsize must be an even
power of 2 in order to work properly.  This restriction is not mentioned
in the documentation, and is probably not intended.

Thanks,
Rick

-------- Begin enclosed patch --------
*** indent-1.6/io.c	Fri Aug 28 14:18:01 1992
--- io.c	Fri Aug 28 14:29:59 1992
***************
*** 665,675 ****
        if (current >= target)
  	return (current);	/* line is already long enough */
        curr = current;
!       while ((tcur = curr + tabsize - (curr - 1) % tabsize) <= target)
! 	{
! 	  putc ('\t', output);
! 	  curr = tcur;
! 	}
        while (curr++ < target)
  	putc (' ', output);	/* pad with final blanks */
      }
--- 665,676 ----
        if (current >= target)
  	return (current);	/* line is already long enough */
        curr = current;
!       if( use_tabs )
!         while ((tcur = curr + tabsize - (curr - 1) % tabsize) <= target)
! 	  {
! 	    putc ('\t', output);
! 	    curr = tcur;
! 	  }
        while (curr++ < target)
  	putc (' ', output);	/* pad with final blanks */
      }
*** indent-1.6/args.c	Mon Aug 10 13:32:23 1992
--- args.c	Fri Aug 28 14:33:36 1992
***************
*** 108,113 ****
--- 108,115 ----
  static int exp_ts = 0;
  static int exp_v = 0;
  static int exp_version = 0;
+ /* my commands */
+ static int exp_ut = 0;
  
  /* The following variables are controlled by command line parameters and
     their meaning is explained in indent.h.  */
***************
*** 122,127 ****
--- 124,130 ----
  int indent_parameters;
  int ind_size;
  int tabsize;
+ int use_tabs;
  int blanklines_after_procs;
  int use_stdout;
  int pointer_as_binop;
***************
*** 279,284 ****
--- 282,291 ----
     (int *) VERSION_STRING, &exp_version},
    {"v", PRO_BOOL, false, ON, &verbose, &exp_v},
  
+ /* my additions */
+   {"nut", PRO_BOOL, true, OFF, &use_tabs, &exp_ut},
+   {"ut", PRO_BOOL, true, ON, &use_tabs, &exp_ut},
+ 
  /* Signify end of structure.  */
    {0, PRO_IGN, 0, ONOFF_NA, 0, 0}
  };
***************
*** 385,390 ****
--- 392,401 ----
     (int *) VERSION_STRING, &exp_version},
    {"v", PRO_BOOL, false, ON, &verbose, &exp_v},
  
+ /* my additions */
+   {"nut", PRO_BOOL, true, OFF, &use_tabs, &exp_ut},
+   {"ut", PRO_BOOL, true, ON, &use_tabs, &exp_ut},
+ 
  /* Signify end of structure.  */
    {0, PRO_IGN, 0, ONOFF_NA, 0, 0}
  };
***************
*** 485,490 ****
--- 496,505 ----
    {"tab-size", "ts"},
    {"version", "version"},
    {"verbose", "v"},
+ 
+ /* my own additions */
+   {"dont-use-tabs", "nut"},
+   {"use-tabs", "ut"},
    {0, 0},
  };
  
*** indent-1.6/indent.h	Mon Aug  3 18:41:25 1992
--- indent.h	Fri Aug 28 14:32:33 1992
***************
*** 285,290 ****
--- 285,292 ----
  extern int ind_size;
  /* The number of columns a tab character generates. */
  extern int tabsize;
+ /* Whether to use tabs in the output */
+ extern int use_tabs;
  /* Nonzero if we should use standard input/output when files are not
     explicitly specified.  */
  extern int use_stdinout;
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