summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-08-26 13:37:44 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-08-26 13:37:44 +0300
commit93f7104a653bd2e5fe2008eb8f42334d9df8542a (patch)
treebb0bfa2bf7b2af9b5514e4dfcdda316889c14074 /src/nxt_runtime.c
parent0d65c896cfa45f5e3fef05d95c9409fd68ff45c8 (diff)
downloadunit-93f7104a653bd2e5fe2008eb8f42334d9df8542a.tar.gz
unit-93f7104a653bd2e5fe2008eb8f42334d9df8542a.tar.bz2
Added configure and command line option --help.
Diffstat (limited to '')
-rw-r--r--src/nxt_runtime.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 6f66f5cd..7c2c5fcd 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -800,6 +800,37 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
static const char no_modules[] =
"option \"--modules\" requires directory\n";
+ static const char help[] =
+ "\n"
+ "nginext options:\n"
+ "\n"
+ " --version print nginext version and configure options\n"
+ "\n"
+ " --no-daemon run nginext in non-daemon mode\n"
+ "\n"
+ " --control ADDRESS set address of control API socket\n"
+ " default: \"" NXT_CONTROL_SOCK "\"\n"
+ "\n"
+ " --pid FILE set pid file name\n"
+ " default: \"" NXT_PID "\"\n"
+ "\n"
+ " --log FILE set log file name\n"
+ " default: \"" NXT_LOG "\"\n"
+ "\n"
+ " --modules DIRECTORY set modules directory\n"
+ " default: \"" NXT_MODULES "\"\n"
+ "\n"
+ " --user USER set non-privileged processes to run"
+ " as specified user\n"
+ " default: \"" NXT_USER "\"\n"
+ "\n"
+ " --group GROUP set non-privileged processes to run"
+ " as specified group\n"
+ " default: ";
+
+ static const char group[] = "\"" NXT_GROUP "\"\n\n";
+ static const char primary[] = "user's primary group\n\n";
+
argv = &nxt_process_argv[1];
while (*argv != NULL) {
@@ -908,6 +939,19 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
exit(0);
}
+ if (nxt_strcmp(p, "--help") == 0) {
+ write(STDOUT_FILENO, help, sizeof(help) - 1);
+
+ if (sizeof(NXT_GROUP) == 1) {
+ write(STDOUT_FILENO, primary, sizeof(primary) - 1);
+
+ } else {
+ write(STDOUT_FILENO, group, sizeof(group) - 1);
+ }
+
+ exit(0);
+ }
+
end = nxt_sprintf(buf, buf + sizeof(buf), "unknown option \"%s\"\n", p);
write(STDERR_FILENO, buf, end - buf);