nxt_runtime.c (697:b73f6d3709c2) nxt_runtime.c (703:2d536dde84d2)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 830 unchanged lines hidden (view full) ---

839
840 argv = &nxt_process_argv[1];
841
842 while (*argv != NULL) {
843 p = *argv++;
844
845 if (nxt_strcmp(p, "--control") == 0) {
846 if (*argv == NULL) {
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 830 unchanged lines hidden (view full) ---

839
840 argv = &nxt_process_argv[1];
841
842 while (*argv != NULL) {
843 p = *argv++;
844
845 if (nxt_strcmp(p, "--control") == 0) {
846 if (*argv == NULL) {
847 write(STDERR_FILENO, no_control, sizeof(no_control) - 1);
847 write(STDERR_FILENO, no_control, nxt_length(no_control));
848 return NXT_ERROR;
849 }
850
851 p = *argv++;
852
853 rt->control = p;
854
855 continue;

--- 10 unchanged lines hidden (view full) ---

866 rt->upstream.length = nxt_strlen(p);
867 rt->upstream.start = (u_char *) p;
868
869 continue;
870 }
871
872 if (nxt_strcmp(p, "--user") == 0) {
873 if (*argv == NULL) {
848 return NXT_ERROR;
849 }
850
851 p = *argv++;
852
853 rt->control = p;
854
855 continue;

--- 10 unchanged lines hidden (view full) ---

866 rt->upstream.length = nxt_strlen(p);
867 rt->upstream.start = (u_char *) p;
868
869 continue;
870 }
871
872 if (nxt_strcmp(p, "--user") == 0) {
873 if (*argv == NULL) {
874 write(STDERR_FILENO, no_user, sizeof(no_user) - 1);
874 write(STDERR_FILENO, no_user, nxt_length(no_user));
875 return NXT_ERROR;
876 }
877
878 p = *argv++;
879
880 rt->user_cred.user = p;
881
882 continue;
883 }
884
885 if (nxt_strcmp(p, "--group") == 0) {
886 if (*argv == NULL) {
875 return NXT_ERROR;
876 }
877
878 p = *argv++;
879
880 rt->user_cred.user = p;
881
882 continue;
883 }
884
885 if (nxt_strcmp(p, "--group") == 0) {
886 if (*argv == NULL) {
887 write(STDERR_FILENO, no_group, sizeof(no_group) - 1);
887 write(STDERR_FILENO, no_group, nxt_length(no_group));
888 return NXT_ERROR;
889 }
890
891 p = *argv++;
892
893 rt->group = p;
894
895 continue;
896 }
897
898 if (nxt_strcmp(p, "--pid") == 0) {
899 if (*argv == NULL) {
888 return NXT_ERROR;
889 }
890
891 p = *argv++;
892
893 rt->group = p;
894
895 continue;
896 }
897
898 if (nxt_strcmp(p, "--pid") == 0) {
899 if (*argv == NULL) {
900 write(STDERR_FILENO, no_pid, sizeof(no_pid) - 1);
900 write(STDERR_FILENO, no_pid, nxt_length(no_pid));
901 return NXT_ERROR;
902 }
903
904 p = *argv++;
905
906 rt->pid = p;
907
908 continue;
909 }
910
911 if (nxt_strcmp(p, "--log") == 0) {
912 if (*argv == NULL) {
901 return NXT_ERROR;
902 }
903
904 p = *argv++;
905
906 rt->pid = p;
907
908 continue;
909 }
910
911 if (nxt_strcmp(p, "--log") == 0) {
912 if (*argv == NULL) {
913 write(STDERR_FILENO, no_log, sizeof(no_log) - 1);
913 write(STDERR_FILENO, no_log, nxt_length(no_log));
914 return NXT_ERROR;
915 }
916
917 p = *argv++;
918
919 rt->log = p;
920
921 continue;
922 }
923
924 if (nxt_strcmp(p, "--modules") == 0) {
925 if (*argv == NULL) {
914 return NXT_ERROR;
915 }
916
917 p = *argv++;
918
919 rt->log = p;
920
921 continue;
922 }
923
924 if (nxt_strcmp(p, "--modules") == 0) {
925 if (*argv == NULL) {
926 write(STDERR_FILENO, no_modules, sizeof(no_modules) - 1);
926 write(STDERR_FILENO, no_modules, nxt_length(no_modules));
927 return NXT_ERROR;
928 }
929
930 p = *argv++;
931
932 rt->modules = p;
933
934 continue;
935 }
936
937 if (nxt_strcmp(p, "--state") == 0) {
938 if (*argv == NULL) {
927 return NXT_ERROR;
928 }
929
930 p = *argv++;
931
932 rt->modules = p;
933
934 continue;
935 }
936
937 if (nxt_strcmp(p, "--state") == 0) {
938 if (*argv == NULL) {
939 write(STDERR_FILENO, no_state, sizeof(no_state) - 1);
939 write(STDERR_FILENO, no_state, nxt_length(no_state));
940 return NXT_ERROR;
941 }
942
943 p = *argv++;
944
945 rt->state = p;
946
947 continue;
948 }
949
950 if (nxt_strcmp(p, "--no-daemon") == 0) {
951 rt->daemon = 0;
952 continue;
953 }
954
955 if (nxt_strcmp(p, "--version") == 0) {
940 return NXT_ERROR;
941 }
942
943 p = *argv++;
944
945 rt->state = p;
946
947 continue;
948 }
949
950 if (nxt_strcmp(p, "--no-daemon") == 0) {
951 rt->daemon = 0;
952 continue;
953 }
954
955 if (nxt_strcmp(p, "--version") == 0) {
956 write(STDERR_FILENO, version, sizeof(version) - 1);
956 write(STDERR_FILENO, version, nxt_length(version));
957 exit(0);
958 }
959
960 if (nxt_strcmp(p, "--help") == 0 || nxt_strcmp(p, "-h") == 0) {
957 exit(0);
958 }
959
960 if (nxt_strcmp(p, "--help") == 0 || nxt_strcmp(p, "-h") == 0) {
961 write(STDOUT_FILENO, help, sizeof(help) - 1);
961 write(STDOUT_FILENO, help, nxt_length(help));
962
963 if (sizeof(NXT_GROUP) == 1) {
962
963 if (sizeof(NXT_GROUP) == 1) {
964 write(STDOUT_FILENO, primary, sizeof(primary) - 1);
964 write(STDOUT_FILENO, primary, nxt_length(primary));
965
966 } else {
965
966 } else {
967 write(STDOUT_FILENO, group, sizeof(group) - 1);
967 write(STDOUT_FILENO, group, nxt_length(group));
968 }
969
970 exit(0);
971 }
972
973 end = nxt_sprintf(buf, buf + sizeof(buf), "unknown option \"%s\", "
974 "try \"%s -h\" for available options\n",
975 p, nxt_process_argv[0]);

--- 615 unchanged lines hidden ---
968 }
969
970 exit(0);
971 }
972
973 end = nxt_sprintf(buf, buf + sizeof(buf), "unknown option \"%s\", "
974 "try \"%s -h\" for available options\n",
975 p, nxt_process_argv[0]);

--- 615 unchanged lines hidden ---