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