xref: /netbsd-src/tests/usr.bin/indent/opt_ip.c (revision 47306038c7d906b62edca1fd252c0e0d0772f5a0)
1 /* $NetBSD: opt_ip.c,v 1.7 2022/04/24 09:04:12 rillig Exp $ */
2 
3 /*
4  * Tests for the options '-ip' and '-nip'.
5  *
6  * The option '-ip' indents parameter declarations from the left margin, for
7  * traditional function definitions.
8  *
9  * The option '-nip' places the parameter declarations in column 1.
10  */
11 
12 //indent input
13 double
plus3(a,b,c)14 plus3(a, b, c)
15 	double a, b, c;
16 {
17 	return a + b + c;
18 }
19 //indent end
20 
21 //indent run -ip
22 double
plus3(a,b,c)23 plus3(a, b, c)
24 	double		a, b, c;
25 {
26 	return a + b + c;
27 }
28 //indent end
29 
30 //indent run -nip
31 double
plus3(a,b,c)32 plus3(a, b, c)
33 double		a, b, c;
34 {
35 	return a + b + c;
36 }
37 //indent end
38 
39 
40 //indent input
41 int
42 first_parameter_in_same_line(int a,
43 int b,
44 const char *cp);
45 
46 int
47 parameters_in_separate_lines(
48 int a,
49 int b,
50 const char *cp);
51 
52 int
53 multiple_parameters_per_line(
54 int a1, int a2,
55 int b1, int b2,
56 const char *cp);
57 //indent end
58 
59 //indent run -ip
60 int
61 first_parameter_in_same_line(int a,
62 			     int b,
63 			     const char *cp);
64 
65 int
66 parameters_in_separate_lines(
67 			     int a,
68 			     int b,
69 			     const char *cp);
70 
71 int
72 multiple_parameters_per_line(
73 			     int a1, int a2,
74 			     int b1, int b2,
75 			     const char *cp);
76 //indent end
77 
78 //indent run-equals-prev-output -nip
79