Home | History | Annotate | Line # | Download | only in indent
      1 /* $NetBSD: opt_sob.c,v 1.10 2023/06/05 12:01:34 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 //indent input
     15 void		function_declaration(void);
     16 
     17 
     18 int
     19 function_with_0_blank_lines(void)
     20 {
     21 	int		var;
     22 	var = value;
     23 	if (var > 0)
     24 		var--;
     25 	if (var > 0) {
     26 		var--;
     27 	}
     28 	return var;
     29 }
     30 
     31 int
     32 function_with_1_blank_line(void)
     33 {
     34 
     35 	int		var;
     36 
     37 	var = value;
     38 
     39 	if (var > 0)
     40 /* $ The following line is "optional" and is removed due to '-sob'. */
     41 
     42 		var--;
     43 
     44 	if (var > 0) {
     45 /* $ The following line is "optional" and is removed due to '-sob'. */
     46 
     47 		var--;
     48 
     49 	}
     50 
     51 	return var;
     52 
     53 }
     54 
     55 
     56 int
     57 function_with_2_blank_lines(void)
     58 {
     59 
     60 
     61 	int		var;
     62 
     63 
     64 	var = value;
     65 
     66 
     67 	if (var > 0)
     68 /* $ The following 2 lines are "optional" and are removed due to '-sob'. */
     69 
     70 
     71 		var--;
     72 
     73 
     74 	if (var > 0) {
     75 
     76 
     77 		var--;
     78 
     79 
     80 	}
     81 
     82 
     83 	return var;
     84 
     85 
     86 }
     87 //indent end
     88 
     89 //indent run -sob
     90 void		function_declaration(void);
     91 
     92 
     93 int
     94 function_with_0_blank_lines(void)
     95 {
     96 	int		var;
     97 	var = value;
     98 	if (var > 0)
     99 		var--;
    100 	if (var > 0) {
    101 		var--;
    102 	}
    103 	return var;
    104 }
    105 
    106 int
    107 function_with_1_blank_line(void)
    108 {
    109 
    110 	int		var;
    111 
    112 	var = value;
    113 
    114 	if (var > 0)
    115 		var--;
    116 
    117 	if (var > 0) {
    118 
    119 		var--;
    120 
    121 	}
    122 
    123 	return var;
    124 
    125 }
    126 
    127 
    128 int
    129 function_with_2_blank_lines(void)
    130 {
    131 
    132 	int		var;
    133 
    134 	var = value;
    135 
    136 	if (var > 0)
    137 		var--;
    138 
    139 	if (var > 0) {
    140 
    141 		var--;
    142 
    143 	}
    144 
    145 	return var;
    146 
    147 }
    148 //indent end
    149 
    150 //indent run-equals-input -nsob
    151 
    152 
    153 //indent input
    154 {
    155 	switch (expr) {
    156 
    157 	case 1:
    158 
    159 	}
    160 }
    161 //indent end
    162 
    163 //indent run-equals-input -sob
    164 
    165 //indent run -sob -bl
    166 {
    167 	switch (expr)
    168 	{
    169 
    170 	case 1:
    171 
    172 	}
    173 }
    174 //indent end
    175