1 /* $NetBSD: opt_dj.c,v 1.7 2022/04/24 09:04:12 rillig Exp $ */ 2 3 /* 4 * Tests for the options '-dj' and '-ndj'. 5 * 6 * The option '-dj' left-justifies declarations of local variables. 7 * 8 * The option '-ndj' indents declarations the same as code. 9 */ 10 11 /* For top-level declarations, '-dj' and '-ndj' produce the same output. */ 12 //indent input 13 int i; 14 int *ip; 15 const char *ccp; 16 const void *****vppppp; 17 const void ******vpppppp; 18 const void ********vpppppppp; 19 //indent end 20 21 //indent run -dj 22 int i; 23 int *ip; 24 const char *ccp; 25 const void *****vppppp; 26 const void ******vpppppp; 27 const void ********vpppppppp; 28 //indent end 29 30 //indent run-equals-prev-output -ndj 31 32 33 //indent input 34 void example(void) { 35 int decl; 36 code(); 37 } 38 //indent end 39 40 //indent run -dj 41 void 42 example(void) 43 { 44 int decl; 45 code(); 46 } 47 //indent end 48 49 //indent run -ndj 50 void 51 example(void) 52 { 53 int decl; 54 code(); 55 } 56 //indent end 57 58 59 /* 60 * The option '-dj' does not influence traditional function definitions. 61 */ 62 //indent input 63 double 64 dbl_plus3(a, b, c) 65 double a, b, c; 66 { 67 return a + b + c; 68 } 69 //indent end 70 71 //indent run -dj 72 double 73 dbl_plus3(a, b, c) 74 double a, b, c; 75 { 76 return a + b + c; 77 } 78 //indent end 79