mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-28 02:13:49 +00:00
Add help option
* updated cli option 'help' - all 5 apps supports cli option '-h' without error exit code - supports long option '--help' * fixed bad line brake
This commit is contained in:
+15
-4
@@ -572,10 +572,11 @@ int main(int argc, char **argv)
|
||||
|
||||
int option_index = 0;
|
||||
static struct option long_options[] = {
|
||||
{ "fast-open", no_argument, 0, 0 },
|
||||
{ "acl", required_argument, 0, 0 },
|
||||
{ "fast-open" , no_argument , 0, 0 },
|
||||
{ "acl" , required_argument, 0, 0 },
|
||||
{ "manager-address", required_argument, 0, 0 },
|
||||
{ "executable", required_argument, 0, 0 },
|
||||
{ "executable" , required_argument, 0, 0 },
|
||||
{ "help" , no_argument , 0, 0 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -583,7 +584,7 @@ int main(int argc, char **argv)
|
||||
|
||||
USE_TTY();
|
||||
|
||||
while ((c = getopt_long(argc, argv, "f:s:l:k:t:m:c:i:d:a:uUvA",
|
||||
while ((c = getopt_long(argc, argv, "f:s:l:k:t:m:c:i:d:a:huUvA",
|
||||
long_options, &option_index)) != -1)
|
||||
switch (c) {
|
||||
case 0:
|
||||
@@ -595,6 +596,9 @@ int main(int argc, char **argv)
|
||||
manager_address = optarg;
|
||||
} else if (option_index == 3) {
|
||||
executable = optarg;
|
||||
} else if (option_index == 4) {
|
||||
usage();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
@@ -638,9 +642,16 @@ int main(int argc, char **argv)
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'A':
|
||||
auth = 1;
|
||||
break;
|
||||
case '?':
|
||||
// The option character is not recognized.
|
||||
opterr = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (opterr) {
|
||||
|
||||
Reference in New Issue
Block a user