<div dir="ltr">ok, managed to pass that hurdle - I'm basically using a fairly old piece of code to base my module on - namely, cdr_manager.c, <br>so the configuration parser in there is slightly different. <div><br></div><div>Minor question, is there a "safe" asterisk method of doing a "sprintf"? </div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 16, 2017 at 1:16 PM Joshua Colp <<a href="mailto:jcolp@digium.com">jcolp@digium.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Oct 16, 2017, at 06:45 AM, Nir Simionovich wrote:<br>
> Ok, that helped - looks like I'm linking correctly now.<br>
><br>
> Different question, I remember their used to be a "safe string copy"<br>
> function that I'm supposed to use,<br>
> instead of using strcpy. Mainly, I want to parse my configuration file<br>
> correctly, but I can't find any<br>
> specific methodology for doing this in a uniform asteriskish manner.<br>
<br>
>From a configuration perspective there's two APIs:<br>
<br>
If only .conf files are needed then there is the Asterisk Config Options<br>
API, include/asterisk/config_options.h, which is used by the skeleton<br>
application apps/app_skel.c for configuration parsing, storing, and<br>
usage.<br>
<br>
If realtime is needed then there is the Asterisk Sorcery API,<br>
include/asterisk/sorcery.h, which is used by PJSIP and other things -<br>
with the simplest being res/res_mwi_external.c<br>
<br>
It's highly recommended to use one of them instead of rolling your own<br>
configuration parsing. They take care of things (such as safe atomic<br>
reloads).<br>
<br>
The "safe string copy" you are thinking of is probably ast_copy_string.<br>
<br>
--<br>
Joshua Colp<br>
Digium, Inc. | Senior Software Developer<br>
445 Jan Davis Drive NW - Huntsville, AL 35806 - US<br>
Check us out at: <a href="http://www.digium.com" rel="noreferrer" target="_blank">www.digium.com</a> & <a href="http://www.asterisk.org" rel="noreferrer" target="_blank">www.asterisk.org</a><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><font size="3"><span style="font-family:"courier new"">Kind Regards,</span><span style="color:rgb(31,73,125)"></span></font></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><font size="3"><span style="font-family:"courier new""> Nir Simionovich</span><span style="color:rgb(31,73,125)"></span></font></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><font size="3"><span style="font-family:"courier new""> GreenfieldTech</span><span style="color:rgb(31,73,125)"></span></font></p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><font size="3"><span style="font-family:"courier new""> (schedule) </span></font><font face="Courier New" size="3"><a href="http://nirsimionovich.appointy.com/" target="_blank" style="color:rgb(17,85,204)">http://nirsimionovich.appointy.com/</a></font></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3"> (w)<span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span></font><a href="http://www.greenfieldtech.net/" target="_blank" style="color:rgb(17,85,204)"><span style="color:blue"><font size="3">http://www.greenfieldtech.net</font></span></a><font size="3"> </font></span></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3"> (p) +972-73-2557799 <span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span>(MSN):<span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span></font><a href="mailto:nirs@greenfieldtech.net" target="_blank" style="color:rgb(17,85,204)"><span style="color:blue"><font size="3">nirs@greenfieldtech.net</font></span></a></span></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3"> (m) +972-54-6982826 <span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span>(GTALK):<span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span></font><a href="mailto:nir.simionovich@gmail.com" target="_blank" style="color:rgb(17,85,204)"><span style="color:blue"><font size="3">nir.simionovich@gmail.com</font></span></a><span style="color:rgb(31,73,125)"></span></span></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3"> (f) +972-73-2557202 <span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span>(SKYPE): greenfieldtech.nir</font></span></p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><br></p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3">----------------------------------------------------------</font></span></p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3"> <a href="https://mailstrom.co/referral/ARZJE" target="_blank" style="color:rgb(17,85,204)">Zero Your Inbox</a> | <a href="https://www.digitalocean.com/?refcode=97eeea09917a" target="_blank" style="color:rgb(17,85,204)">Cloud Servers</a></font></span></p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal;margin:0in 0in 0pt"><span style="font-family:"courier new""><font size="3">----------------------------------------------------------</font></span><span style="font-family:calibri;font-size:medium;line-height:0px"> </span></p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;margin:7.5pt 0in 0pt;line-height:0px"><span style="font-family:"courier new""></span></p><font size="3" face="Times New Roman" style="color:rgb(34,34,34);line-height:normal"></font><font face="Times New Roman" style="color:rgb(34,34,34);font-size:small;line-height:normal"></font><table border="0" cellspacing="3" cellpadding="0" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;line-height:normal"><tbody><tr><td style="margin:0px"><font face="Times New Roman"></font></td></tr></tbody><tbody><tr><td style="margin:0px;padding:0.75pt;border:rgb(0,0,0);background-image:initial;background-size:initial;background-origin:initial;background-clip:initial;background-position:initial;background-repeat:initial"><font face="Times New Roman"></font><p style="margin:0in 0in 0pt"><b><span style="font-family:"courier new"">Disclaimer:</span></b><br></p><p style="margin:0in 0in 0pt"><span style="font-family:"courier new"">This e-mail is intended solely for the person to whom it is addressed and may contain confidential or legally privileged information. Access to this e-mail by anyone else is unauthorized. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail and destroy this e-mail and any attachments.<span class="inbox-inbox-inbox-inbox-Apple-converted-space"> </span><br>E-mail may be susceptible to data corruption, interception, unauthorized amendment, viruses and delays or the consequences thereof. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited.</span></p></td></tr></tbody></table></div></div>