🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #679

indent-1.6: Patch to add --dont-use-tabs feature for output

#679
From: 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;
Technical Details
Message-ID: <9208282213.AA17831@hpic006.MENTORG.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!wv.mentorg.COM!fsf

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!wv.mentorg.COM!fsf
From: fsf@wv.mentorg.COM (Rick Farnbach)
Subject: indent-1.6: Patch to add --dont-use-tabs feature for output
Message-ID: <9208282213.AA17831@hpic006.MENTORG.COM>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 28 Aug 1992 22:13:24 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 117