Home | History | Annotate | Line # | Download | only in indent
opt_ce.c revision 1.6
      1 /* $NetBSD: opt_ce.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */
      2 
      3 /*
      4  * Tests for the options '-ce' and '-nce'.
      5  *
      6  * The option '-ce' places the 'else' on the same line as the preceding '}'.
      7  *
      8  * The option '-nce' places the 'else' on the next line.
      9  *
     10  * See also:
     11  *	opt_ei.c
     12  */
     13 
     14 //indent input
     15 void
     16 example(int n)
     17 {
     18 	if (n > 99) { print("large"); }
     19 	else if (n > 9) { print("double-digit"); }
     20 	else if (n > 0) print("positive");
     21 	else { print("negative"); }
     22 }
     23 //indent end
     24 
     25 //indent run -ce
     26 void
     27 example(int n)
     28 {
     29 	if (n > 99) {
     30 		print("large");
     31 	} else if (n > 9) {
     32 		print("double-digit");
     33 	} else if (n > 0)
     34 		print("positive");
     35 	else {
     36 		print("negative");
     37 	}
     38 }
     39 //indent end
     40 
     41 //indent run -nce
     42 void
     43 example(int n)
     44 {
     45 	if (n > 99) {
     46 		print("large");
     47 	}
     48 	else if (n > 9) {
     49 		print("double-digit");
     50 	}
     51 	else if (n > 0)
     52 		print("positive");
     53 	else {
     54 		print("negative");
     55 	}
     56 }
     57 //indent end
     58