<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Daniel!<br>
      <br>
      The majority of OpenSIPS's codebase relies on "str"-based strings,
      which are basically both a memory and performance optimization,
      but they make programming/debugging more difficult, since most of
      them will not be NULL-terminated anymore, making you unable to use
      half (if not more) of glibc's string processing functions.<br>
      <br>
      atoi() may very well be one of the above cases. In order to
      confirm this, could you print each of your 3 values before feeding
      it to atoi()?<br>
      <br>
      ...<br>
      LM_INFO("XXX value: '%.*s'\n", node-&gt;value.len,
      node-&gt;value.s);</tt><tt><br>
      ...<br>
    </tt>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 09.07.2016 23:26, Daniel Zanutti
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAN0jgiOw3pS3Xx90M1GjZS-XJFHg=kGXNzqGJ9OXU0UXWiEv7g@mail.gmail.com"
      type="cite">
      <div dir="ltr"><span style="font-size:12.8px">I'm trying to read 3
          integers parameters from MI, but Opensips is for some reason
          combining 2 values.</span>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">This is the command: opensipsctl
          fifo custom_check 10 2000 50000</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">For some reason, I'm getting these
          values on the nodes:</div>
        <div style="font-size:12.8px">val1 = 10</div>
        <div style="font-size:12.8px">val2 = 200050000</div>
        <div style="font-size:12.8px">val3 = 50000</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">This is the summarized code:</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">
          <div>struct mi_root * custom_check(struct mi_root *cmd_tree,
            void *param )</div>
          <div>{</div>
          <div><span style="white-space:pre-wrap">        </span>struct
            mi_node* node;</div>
        </div>
        <div style="font-size:12.8px">        int val1, val2, val3;</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">
          <div><span style="white-space:pre-wrap">        </span>node =
            cmd_tree-&gt;node.kids;</div>
          <div><span style="white-space:pre-wrap">        </span>if
            (!node-&gt;value.s || !node-&gt;value.len)</div>
          <div><span style="white-space:pre-wrap">                </span>return
            init_mi_tree( 400, MI_SSTR(MI_BAD_PARM));</div>
          <div><span style="white-space:pre-wrap">        </span>val1 =
            atoi(node-&gt;value.s);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre-wrap">        </span>node =
            node-&gt;next;</div>
          <div><span style="white-space:pre-wrap">        </span>if (
            !node-&gt;value.s || !node-&gt;value.len)</div>
          <div><span style="white-space:pre-wrap">                </span>return
            init_mi_tree( 400, MI_SSTR(MI_BAD_PARM));</div>
          <div><span style="white-space:pre-wrap">        </span>val2 =
            atoi(node-&gt;value.s);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre-wrap">        </span>node =
            node-&gt;next;</div>
          <div><span style="white-space:pre-wrap">        </span>if (
            !node-&gt;value.s || !node-&gt;value.len)</div>
          <div><span style="white-space:pre-wrap">                </span>return
            init_mi_tree( 400, MI_SSTR(MI_BAD_PARM));</div>
          <div><span style="white-space:pre-wrap">        </span>val3 =
            atoi(node-&gt;value.s);</div>
        </div>
        <div style="font-size:12.8px">        .....</div>
        <div style="font-size:12.8px">}</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">Am I doing something wrong? </div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">Thanks in advance</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>