]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Introduce ORTE_STRENGTH environment variable
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 27 Feb 2013 10:44:25 +0000 (11:44 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 27 Feb 2013 10:44:25 +0000 (11:44 +0100)
It can be used to override strength of publishers in the given application.

src/types/roboortegen.pl

index 8061347095b08c67e1a1640d9d1b1827d9e470c6..ae3a197d747d264bb9d772ff7db569a4637bc5bf 100755 (executable)
@@ -300,6 +300,7 @@ print OUTFILE << "(END)";
  */
 
 #include "$library_name_prefix$roboorte_name.h"
+#include <stdlib.h>
 
 /* ---------------------------------------------------------------------- 
  * CREATE PUBLISHERS
@@ -390,12 +391,20 @@ print OUTFILE << "(END)";
 int ${roboorte_name}_roboorte_init(struct ${roboorte_name}_orte_data *data)
 {
 \tint rv = 0;
+\tconst char *s;
 \tORTEDomainProp prop;
 \tORTEInit();
 
 \tif ($data_arg_name->strength <= 0)
 \t\t$data_arg_name->strength = $publication_strength;
 
+       if ((s = getenv("ORTE_STRENGTH"))) {
+               char *end;
+               long l = strtol(s, &end, 10);
+               if (s != end)
+                       data->strength = l;
+       }
+
 \tORTEVerbositySetOptions("ALL.0");
 \tORTEDomainPropDefaultGet(&prop);
 \tNTPTIME_BUILD(prop.baseProp.refreshPeriod, $refresh_period);