@@ -30,8 +30,7 @@ static void print_usage(const char *argv0) {
30
30
printf ("\n" );
31
31
printf ("--socket-group=GROUP socket group name (default: "
32
32
"\"" CLI_DEFAULT_SOCKET_GROUP "\")\n" );
33
- printf (
34
- "--vmnet-mode=(host|shared|bridged) vmnet mode (default: \"shared\")\n" );
33
+ printf ("--vmnet-mode=(host|shared|bridged) vmnet mode (default: \"shared\")\n" );
35
34
printf ("--vmnet-interface=INTERFACE interface used for "
36
35
"--vmnet=bridged, e.g., \"en0\"\n" );
37
36
printf ("--vmnet-gateway=IP gateway used for "
@@ -83,18 +82,18 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
83
82
}
84
83
85
84
const struct option longopts [] = {
86
- {"socket-group" , required_argument , NULL , CLI_OPT_SOCKET_GROUP },
87
- {"vmnet-mode" , required_argument , NULL , CLI_OPT_VMNET_MODE },
88
- {"vmnet-interface" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE },
89
- {"vmnet-gateway" , required_argument , NULL , CLI_OPT_VMNET_GATEWAY },
90
- {"vmnet-dhcp-end" , required_argument , NULL , CLI_OPT_VMNET_DHCP_END },
91
- {"vmnet-mask" , required_argument , NULL , CLI_OPT_VMNET_MASK },
92
- {"vmnet-interface-id" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE_ID },
93
- {"vmnet-nat66-prefix" , required_argument , NULL , CLI_OPT_VMNET_NAT66_PREFIX },
94
- {"pidfile" , required_argument , NULL , 'p' },
95
- {"help" , no_argument , NULL , 'h' },
96
- {"version" , no_argument , NULL , 'v' },
97
- {0 , 0 , 0 , 0 },
85
+ {"socket-group" , required_argument , NULL , CLI_OPT_SOCKET_GROUP },
86
+ {"vmnet-mode" , required_argument , NULL , CLI_OPT_VMNET_MODE },
87
+ {"vmnet-interface" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE },
88
+ {"vmnet-gateway" , required_argument , NULL , CLI_OPT_VMNET_GATEWAY },
89
+ {"vmnet-dhcp-end" , required_argument , NULL , CLI_OPT_VMNET_DHCP_END },
90
+ {"vmnet-mask" , required_argument , NULL , CLI_OPT_VMNET_MASK },
91
+ {"vmnet-interface-id" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE_ID },
92
+ {"vmnet-nat66-prefix" , required_argument , NULL , CLI_OPT_VMNET_NAT66_PREFIX },
93
+ {"pidfile" , required_argument , NULL , 'p' },
94
+ {"help" , no_argument , NULL , 'h' },
95
+ {"version" , no_argument , NULL , 'v' },
96
+ {0 , 0 , 0 , 0 },
98
97
};
99
98
int opt = 0 ;
100
99
while ((opt = getopt_long (argc , argv , "hvp:" , longopts , NULL )) != -1 ) {
@@ -158,8 +157,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
158
157
159
158
/* fill default */
160
159
if (res -> socket_group == NULL )
161
- res -> socket_group =
162
- strdup (CLI_DEFAULT_SOCKET_GROUP ); /* use strdup to make it freeable */
160
+ res -> socket_group = strdup (CLI_DEFAULT_SOCKET_GROUP ); /* use strdup to make it freeable */
163
161
if (res -> vmnet_mode == 0 )
164
162
res -> vmnet_mode = VMNET_SHARED_MODE ;
165
163
if (res -> vmnet_gateway != NULL && res -> vmnet_dhcp_end == NULL ) {
@@ -182,8 +180,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
182
180
res -> vmnet_dhcp_end = strdup (end_static );
183
181
}
184
182
if (res -> vmnet_gateway != NULL && res -> vmnet_mask == NULL )
185
- res -> vmnet_mask =
186
- strdup ("255.255.255.0" ); /* use strdup to make it freeable */
183
+ res -> vmnet_mask = strdup ("255.255.255.0" ); /* use strdup to make it freeable */
187
184
if (uuid_is_null (res -> vmnet_interface_id )) {
188
185
uuid_generate_random (res -> vmnet_interface_id );
189
186
}
@@ -196,7 +193,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
196
193
if (res -> vmnet_gateway == NULL ) {
197
194
if (res -> vmnet_mode != VMNET_BRIDGED_MODE ) {
198
195
WARN ("--vmnet-gateway=IP should be explicitly specified to "
199
- "avoid conflicting with other applications" );
196
+ "avoid conflicting with other applications" );
200
197
}
201
198
if (res -> vmnet_dhcp_end != NULL ) {
202
199
ERROR ("--vmnet-dhcp-end=IP requires --vmnet-gateway=IP" );
@@ -213,8 +210,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
213
210
}
214
211
struct in_addr dummy ;
215
212
if (!inet_aton (res -> vmnet_gateway , & dummy )) {
216
- ERRORF ("invalid address \"%s\" was specified for --vmnet-gateway" ,
217
- res -> vmnet_gateway );
213
+ ERRORF ("invalid address \"%s\" was specified for --vmnet-gateway" , res -> vmnet_gateway );
218
214
goto error ;
219
215
}
220
216
}
0 commit comments