aboutsummaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2006-07-16 14:53:27 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 11:51:24 +0200
commit6bb77d38ade9ee7993be37cdac2d67c2d6a568cf (patch)
treecbd61aa60421f2a099ef4546429808ead56ebb60 /init/init.c
parent[RELEASE] flxutils-0.1.13 (diff)
downloadflxutils-6bb77d38ade9ee7993be37cdac2d67c2d6a568cf.tar.xz
[RELEASE] flxutils-0.1.14v0.1.14
Diffstat (limited to '')
-rw-r--r--init/init.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/init/init.c b/init/init.c
index d8d1906..3f6b45f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -1328,12 +1328,28 @@ int main(int argc, char **argv, char **envp) {
conf_init = cfg_args[1];
continue;
}
- //} else if (token == TOK_EC) {
- /* ec <string> : echo a string */
- //int l = strlen(cfg_args[1]);
- //cfg_args[1][l] = '\n';
- //write(1, cfg_args[1], l + 1);
- //goto finish_cmd;
+ } else if (token == TOK_TE) {
+ /* te <var=val> : compare an environment variable to a value.
+ * In fact, look for the exact assignment in the environment.
+ * The result is OK if found, NOK if not.
+ */
+ char **env = envp;
+ while (*env) {
+ //printf("testing <%s> against <%s>\n", cfg_args[1], *env);
+ if (!strcmp(*env, cfg_args[1]))
+ break;
+ env++;
+ }
+ error = (*env == NULL);
+ goto finish_cmd;
+ }
+
+ /* other options are reserved for pid 1/linuxrc/rebuild and prompt mode */
+ if (!pid1 && !linuxrc && !rebuild && cmd_input != INPUT_KBD) {
+ print("Command ignored since pid not 1\n");
+ error = context[brace_level].error;
+ continue;
+
} else if (token == TOK_RD || token == TOK_EC) {
/* ec <string> : echo a string */
/* rd <string> : display message then read commands from the console instead of the file */
@@ -1360,27 +1376,6 @@ int main(int argc, char **argv, char **envp) {
write(1, msg, len);
cmd_input = INPUT_KBD;
continue;
- } else if (token == TOK_TE) {
- /* te <var=val> : compare an environment variable to a value.
- * In fact, look for the exact assignment in the environment.
- * The result is OK if found, NOK if not.
- */
- char **env = envp;
- while (*env) {
- //printf("testing <%s> against <%s>\n", cfg_args[1], *env);
- if (!strcmp(*env, cfg_args[1]))
- break;
- env++;
- }
- error = (*env == NULL);
- goto finish_cmd;
- }
-
- /* other options are reserved for pid 1/linuxrc/rebuild and prompt mode */
- if (!pid1 && !linuxrc && !rebuild && cmd_input != INPUT_KBD) {
- print("Command ignored since pid not 1\n");
- error = context[brace_level].error;
- continue;
}
/* the second command set is available if pid==1 or if "rebuild" is set */