Home | History | Annotate | Line # | Download | only in indent
opt_cli.c revision 1.2
      1 /* $NetBSD: opt_cli.c,v 1.2 2021/11/20 16:54:17 rillig Exp $ */
      2 /* $FreeBSD$ */
      3 
      4 /*
      5  * Tests for the option '-cli' ("case label indentation"), which sets the
      6  * amount of indentation of a 'case' relative to the surrounding 'switch',
      7  * measured in indentation levels.
      8  *
      9  * See also:
     10  *	lsym_case_label.c
     11  */
     12 
     13 #indent input
     14 void
     15 classify(int n)
     16 {
     17 	switch (n) {
     18 	case 0: print("zero"); break;
     19 	case 1: print("one"); break;
     20 	case 2: case 3: print("prime"); break;
     21 	case 4: print("square"); break;
     22 	default: print("large"); break;
     23 	}
     24 }
     25 #indent end
     26 
     27 #indent run -cli1.5
     28 void
     29 classify(int n)
     30 {
     31 	switch (n) {
     32 		    case 0:
     33 			print("zero");
     34 			break;
     35 		    case 1:
     36 			print("one");
     37 			break;
     38 		    case 2:
     39 		    case 3:
     40 			print("prime");
     41 			break;
     42 		    case 4:
     43 			print("square");
     44 			break;
     45 		    default:
     46 			print("large");
     47 			break;
     48 	}
     49 }
     50 #indent end
     51