summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/src/command_line_arguments.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2016-01-04 22:48:58 -0500
committerirungentoo <irungentoo@gmail.com>2016-01-04 22:48:58 -0500
commit405854e1e70a22d042cd0e544d1460055b65d57a (patch)
treee5cc9fc5fda064fa57df467bf949742852f283ac /other/bootstrap_daemon/src/command_line_arguments.c
parentc6bed82d47aa39709bdd568fccc3847714ed1b74 (diff)
Cleanups.
Diffstat (limited to 'other/bootstrap_daemon/src/command_line_arguments.c')
-rw-r--r--other/bootstrap_daemon/src/command_line_arguments.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/other/bootstrap_daemon/src/command_line_arguments.c b/other/bootstrap_daemon/src/command_line_arguments.c
index 187fa786..ecfef1ad 100644
--- a/other/bootstrap_daemon/src/command_line_arguments.c
+++ b/other/bootstrap_daemon/src/command_line_arguments.c
@@ -41,26 +41,27 @@ void print_help()
41 // make sure all lines fit into 80 columns 41 // make sure all lines fit into 80 columns
42 // make sure options are listed in alphabetical order 42 // make sure options are listed in alphabetical order
43 write_log(LOG_LEVEL_INFO, 43 write_log(LOG_LEVEL_INFO,
44 "Usage: tox-bootstrapd [OPTION]... --config=FILE_PATH\n" 44 "Usage: tox-bootstrapd [OPTION]... --config=FILE_PATH\n"
45 "\n" 45 "\n"
46 "Options:\n" 46 "Options:\n"
47 " --config=FILE_PATH Specify path to the config file.\n" 47 " --config=FILE_PATH Specify path to the config file.\n"
48 " This is a required option.\n" 48 " This is a required option.\n"
49 " Set FILE_PATH to a path to an empty file in order to\n" 49 " Set FILE_PATH to a path to an empty file in order to\n"
50 " use default settings.\n" 50 " use default settings.\n"
51 " --foreground Run the daemon in foreground. The daemon won't fork\n" 51 " --foreground Run the daemon in foreground. The daemon won't fork\n"
52 " (detach from the terminal) and won't use the PID file.\n" 52 " (detach from the terminal) and won't use the PID file.\n"
53 " --help Print this help message.\n" 53 " --help Print this help message.\n"
54 " --log-backend=BACKEND Specify which logging backend to use.\n" 54 " --log-backend=BACKEND Specify which logging backend to use.\n"
55 " Valid BACKEND values (case sensetive):\n" 55 " Valid BACKEND values (case sensetive):\n"
56 " syslog Writes log messages to syslog.\n" 56 " syslog Writes log messages to syslog.\n"
57 " Default option when no --log-backend is\n" 57 " Default option when no --log-backend is\n"
58 " specified.\n" 58 " specified.\n"
59 " stdout Writes log messages to stdout/stderr.\n" 59 " stdout Writes log messages to stdout/stderr.\n"
60 " --version Print version information.\n"); 60 " --version Print version information.\n");
61} 61}
62 62
63void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend, bool *run_in_foreground) 63void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend,
64 bool *run_in_foreground)
64{ 65{
65 if (argc < 2) { 66 if (argc < 2) {
66 write_log(LOG_LEVEL_ERROR, "Error: No arguments provided.\n\n"); 67 write_log(LOG_LEVEL_ERROR, "Error: No arguments provided.\n\n");
@@ -115,6 +116,7 @@ void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path,
115 print_help(); 116 print_help();
116 exit(1); 117 exit(1);
117 } 118 }
119
118 break; 120 break;
119 121
120 case 'v': 122 case 'v':
@@ -122,12 +124,12 @@ void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path,
122 exit(0); 124 exit(0);
123 125
124 case '?': 126 case '?':
125 write_log(LOG_LEVEL_ERROR, "Error: Unrecognized option %s\n\n", argv[optind-1]); 127 write_log(LOG_LEVEL_ERROR, "Error: Unrecognized option %s\n\n", argv[optind - 1]);
126 print_help(); 128 print_help();
127 exit(1); 129 exit(1);
128 130
129 case ':': 131 case ':':
130 write_log(LOG_LEVEL_ERROR, "Error: No argument provided for option %s\n\n", argv[optind-1]); 132 write_log(LOG_LEVEL_ERROR, "Error: No argument provided for option %s\n\n", argv[optind - 1]);
131 print_help(); 133 print_help();
132 exit(1); 134 exit(1);
133 } 135 }