<div dir="ltr">Ahh, C memory management and str functions are fun! I like them soooo much, I chose `memcpy` as my vanity domain! <br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 22, 2024 at 2:14 PM William R. Elliot <<a href="mailto:bill@wreassoc.com">bill@wreassoc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<font size="3">At 02:41 AM 10/22/2024, Jim Klimov wrote:<br>
<blockquote type="cite">Hello, always nice to hear about
new drivers :)<br><br>
OTOH, check for any variables you might have been re-using, so their
earlier state impacts later runs - whether buffers allocated statically
(or by caller without rewinding the pointer and maybe nulling the
contents), or position counters, etc. Similarly, be sure to
pre-initialize anything of value and not start out with random bits from
the stack.<br><br>
Also if it is about a series of calls - are there some (loop?) conditions
between the calls that might just preclude them from being called in the
first place?<br><br>
Old-school tracing with debug printouts is good in very many cases;
otherwise it can really help to stage a run in an IDE with a debugger.
Cross-platform wise, I've had consistently good experience with NetBeans
(installing the C/C++ plugin from the NB 8.2 archive after every NB
upgrade is a PITA though); VSCode also worked (at least when I drilled
into NUT for Windows builds with MSYS2) - hints on both are in NUT
docs.<br><br>
Hope this helps,<br>
Jim Klimov<br><br>
<br><br>
On Tue, Oct 22, 2024 at 5:01 AM William R. Elliot
<<a href="mailto:bill@wreassoc.com" target="_blank">bill@wreassoc.com</a>>
wrote:<br>
</blockquote></font>
<dl>
<dd>Hello all,<br><br>
</dd><dd>In my new driver I have a function that searches for the position of
<br>
</dd><dd>a known substring in a delimited string. I am trying to populate a
<br>
</dd><dd>series of integer variables with the position value of various <br>
</dd><dd>substrings. The first call to the function performs correctly but the
<br>
</dd><dd>remaining calls in the code series are not being executed (there are
<br>
</dd><dd>six more calls after the first successful one). Any ideas why only
<br>
</dd><dd>the first call is being done?<br><br>
</dd><dd>Similarly, I have another function that takes a position variable and
<br>
</dd><dd>pulls the data in the nth position from a delimited string. There is
<br>
</dd><dd>also a series of these called in a row and only the first is being
called.<br><br>
</dd><dd>Any ideas on what to look for would be appreciated.<br><br>
</dd><dd>Thanks,<br><br>
</dd><dd>Bill<br><br>
<br><br>
</dd><dd>-- <br>
</dd><dd>This email has been checked for viruses by AVG antivirus
software.<br>
</dd><dd><a href="http://www.avg.com" target="_blank">www.avg.com</a><br><br>
</dd><dd>_______________________________________________<br>
</dd><dd>Nut-upsdev mailing list<br>
</dd><dd><a href="mailto:Nut-upsdev@alioth-lists.debian.net" target="_blank">
Nut-upsdev@alioth-lists.debian.net</a><br>
</dd><dd>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev" target="_blank">
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev</a>
<br>
</dd></dl><br><br>
<font size="3">Thanks for the response Jim.<br><br>
The problem had to do with my mis-understanding of the strtok library
function internals. Making a local copy of the source string in my
function(s) solved the problem as the source buffer was getting whacked
by strtok.<br><br>
Moving on.<br><br>
Bill<br><br>
</font><div id="m_3051551105968768373DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br><table style="border-top:1px solid rgb(211,212,222)"><tbody><tr><td style="width:55px;padding-top:13px"><a href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td><td style="width:470px;padding-top:12px;color:rgb(65,66,78);font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free.<a href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" style="color:rgb(68,83,234)" target="_blank">www.avg.com</a></td></tr></tbody></table><a href="#m_3051551105968768373_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></div>
_______________________________________________<br>
Nut-upsdev mailing list<br>
<a href="mailto:Nut-upsdev@alioth-lists.debian.net" target="_blank">Nut-upsdev@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev</a><br>
</blockquote></div>