[Initng-svn] r4359 - initng/trunk/plugins/bash_parser
svn at initng.thinktux.net
svn at initng.thinktux.net
Sun Jun 4 23:26:30 CEST 2006
Author: jimmy
Date: Sun Jun 4 23:26:29 2006
New Revision: 4359
Modified:
initng/trunk/plugins/bash_parser/bp.c
initng/trunk/plugins/bash_parser/initng_bash_parser.c
Log:
Enable "iset last" variables to work.
Modified: initng/trunk/plugins/bash_parser/bp.c
==============================================================================
--- initng/trunk/plugins/bash_parser/bp.c (original)
+++ initng/trunk/plugins/bash_parser/bp.c Sun Jun 4 23:26:29 2006
@@ -122,6 +122,14 @@
status = bp_new_active(argv[1], service);
break;
}
+
+ /* iset <service> test */
+ if (strcmp(argv0, "set") == 0 ||
+ strcmp(argv0, "iset") == 0)
+ {
+ status = bp_set_variable(service, argv[1], NULL, NULL);
+ break;
+ }
break;
case 3:
@@ -131,6 +139,15 @@
status = bp_get_variable(service, argv[1], argv[2]);
break;
}
+
+ /* iset <service> var test */
+ if (strcmp(argv0, "set") == 0 ||
+ strcmp(argv0, "iset") == 0)
+ {
+ status = bp_set_variable(service, argv[1], argv[2], NULL);
+ break;
+ }
+
break;
case 4:
@@ -193,6 +210,14 @@
status = bp_new_active(argv[1], argv[2]);
break;
}
+ /* iset <service> test */
+ if (strcmp(argv0, "set") == 0 ||
+ strcmp(argv0, "iset") == 0)
+ {
+ status = bp_set_variable(argv[1], argv[2], NULL, NULL);
+ break;
+ }
+
break;
case 4:
@@ -202,6 +227,14 @@
status = bp_get_variable(argv[1], argv[2], argv[3]);
break;
}
+ /* iset <service> var test */
+ if (strcmp(argv0, "set") == 0 ||
+ strcmp(argv0, "iset") == 0)
+ {
+ status = bp_set_variable(argv[1], argv[2], argv[3], NULL);
+ break;
+ }
+
break;
case 5:
@@ -301,6 +334,7 @@
memset(&to_send, 0, sizeof(bp_req));
+ printf("bp_set_variable(%s, %s, %s, %s)\n", service, vartype, varname, value);
to_send.request = SET_VARIABLE;
strncpy(to_send.u.set_variable.service, service, 100);
@@ -309,7 +343,8 @@
if (varname)
strncpy(to_send.u.set_variable.varname, varname, 100);
- strncpy(to_send.u.set_variable.value, value, 1024);
+ if (value)
+ strncpy(to_send.u.set_variable.value, value, 1024);
return (bp_send(&to_send));
}
Modified: initng/trunk/plugins/bash_parser/initng_bash_parser.c
==============================================================================
--- initng/trunk/plugins/bash_parser/initng_bash_parser.c (original)
+++ initng/trunk/plugins/bash_parser/initng_bash_parser.c Sun Jun 4 23:26:29 2006
@@ -223,12 +223,14 @@
s_entry *type;
active_db_h *active = initng_active_db_find_by_exact_name(service);
- /* This one is not required */
- if (strlen(varname) < 1)
+ /* make sure there are filled, or NULL, these variables are not strictly requierd */
+ if (!varname || strlen(varname) < 1)
varname = NULL;
+ if (!value || strlen(value) < 1)
+ value = NULL;
/* but these are */
- if (strlen(service) < 1 || strlen(vartype) < 1 || strlen(value) < 1)
+ if (strlen(service) < 1 || strlen(vartype) < 1)
{
strcpy(rep->message, "Variables missing.");
rep->success = FALSE;
@@ -258,6 +260,17 @@
return;
}
+ /* now we now if variable is required or not */
+ if(!value)
+ {
+ if((type->opt_type != SET && type->opt_type != VARIABLE_SET))
+ {
+ strcpy(rep->message, "Value missing.");
+ rep->success = FALSE;
+ return;
+ }
+ }
+
switch (type->opt_type)
{
case STRING:
More information about the Initng-svn
mailing list