Home | History | Annotate | Line # | Download | only in indent
opt_sob.c revision 1.6
      1 /* $NetBSD: opt_sob.c,v 1.6 2023/05/11 09:28:53 rillig Exp $ */
      2 
      3 /*
      4  * Tests for the options '-sob' and '-nsob'.
      5  *
      6  * The option '-sob' swallows optional blank lines.
      7  *
      8  * XXX: The manual page says: "You can use this to get rid of blank lines
      9  * after declarations."; double check this.
     10  *
     11  * The option '-nsob' keeps optional blank lines as is.
     12  */
     13 
     14 /*
     15  * FIXME: There are lots of 'optional blank lines' here that should be
     16  *  swallowed.
     17  */
     18 //indent input
     19 void		function_declaration(void);
     20 
     21 
     22 int
     23 function_with_0_blank_lines(void)
     24 {
     25 	int		var;
     26 	var = value;
     27 	if (var > 0)
     28 		var--;
     29 	return var;
     30 }
     31 
     32 int
     33 function_with_1_blank_line(void)
     34 {
     35 
     36 	int		var;
     37 
     38 	var = value;
     39 
     40 	if (var > 0)
     41 /* $ The following line is "optional" and is removed due to '-sob'. */
     42 
     43 		var--;
     44 
     45 	return var;
     46 
     47 }
     48 
     49 
     50 int
     51 function_with_2_blank_lines(void)
     52 {
     53 
     54 
     55 	int		var;
     56 
     57 
     58 	var = value;
     59 
     60 
     61 	if (var > 0)
     62 /* $ The following 2 lines are "optional" and are removed due to '-sob'. */
     63 
     64 
     65 	    var--;
     66 
     67 
     68 	return var;
     69 
     70 
     71 }
     72 //indent end
     73 
     74 //indent run -sob
     75 void		function_declaration(void);
     76 
     77 
     78 int
     79 function_with_0_blank_lines(void)
     80 {
     81 	int		var;
     82 	var = value;
     83 	if (var > 0)
     84 		var--;
     85 	return var;
     86 }
     87 
     88 int
     89 function_with_1_blank_line(void)
     90 {
     91 
     92 	int		var;
     93 
     94 	var = value;
     95 
     96 	if (var > 0)
     97 
     98 		var--;
     99 
    100 	return var;
    101 
    102 }
    103 
    104 
    105 int
    106 function_with_2_blank_lines(void)
    107 {
    108 
    109 
    110 	int		var;
    111 
    112 
    113 	var = value;
    114 
    115 
    116 	if (var > 0)
    117 
    118 
    119 		var--;
    120 
    121 
    122 	return var;
    123 
    124 
    125 }
    126 //indent end
    127 
    128 //indent run-equals-prev-output -nsob
    129