RE: function snprint_asciistring

"Mike Ayers" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <83E753BE7B6A324ABB336245BAF1DAAC0ADABEC4@mailserver.metatv-ds.metatv.com>
> From: RP, Giridhara [mailto:[email protected]] 
> Sent: Tuesday, February 24, 2009 12:54 AM

	NOTE:  This is not an authoritative answer!

> We are using snprint_asciistring to get the null terminated 
> ascistring. 
> int
> snprint_asciistring(char *buf, size_t buf_len,
>                     const u_char * cp, size_t len)

> The output is myname\\\\unix. Any reason why 2 extra '\' 
> (escape) is added to the buffer (buf). Please let me know the reason. 

	I believe that this is intended to allow the string to be piped through a unix shell, which would interpret "\\" as "\".  I believe this function implements the `-Oa` functionality.

> Also, is there any function which does not add these extra '\' ?

	printf?

	Well, no, that wouldn't emit "safe" output, would it?  How safe do you need?


	HTH,

Mike

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.