X-MimeOLE: Produced By Microsoft Exchange V6.5
Received: by onstor-exch02.onstor.net 
	id <01C880AF.CB967D6C@onstor-exch02.onstor.net>; Fri, 7 Mar 2008 17:03:10 -0700
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C880AF.CB967D6C"
Content-class: urn:content-classes:message
Subject: RE: strncpy
Date: Fri, 7 Mar 2008 17:03:09 -0700
Message-ID: <BB375AF679D4A34E9CA8DFA650E2B04E08C0F497@onstor-exch02.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E07A8DA87@onstor-exch02.onstor.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: strncpy
Thread-Index: AciArY8f1yECnvN6R8idIGkpF7IswAAABN6QAAA/GmAAADZ9MA==
References: <BB375AF679D4A34E9CA8DFA650E2B04E08C0F480@onstor-exch02.onstor.net> <BB375AF679D4A34E9CA8DFA650E2B04E07A8DA87@onstor-exch02.onstor.net>
From: "Narain Ramadass" <narain.ramadass@onstor.com>
To: "Mike Lee" <mike.lee@onstor.com>,
	"Maxim Kozlovsky" <maxim.kozlovsky@onstor.com>,
	"dl-Software" <dl-software@onstor.com>

This is a multi-part message in MIME format.

------_=_NextPart_001_01C880AF.CB967D6C
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Mike,

Just looked at our implementation in ""code/sm-libc/strncpy.c"":

char8 *
strncpy (
        char8       * dst,
        const char8     * src,
        __SIZE_TYPE__ n
)
{
        char           *d;

        if (!dst || !src)
                return (dst);

        d =3D dst;

        for (; *src && n; d++, src++, n--)
                *d =3D *src;

        while (n--)
<-----------------------------------------
                *d++ =3D '\0';
<-----------------------------------------

        return (dst);

}       /* strncpy() */

Does pad to zeroes!

Narain.

> _____________________________________________=20
> From: 	Mike Lee =20
> Sent:	Friday, March 07, 2008 3:57 PM
> To:	Maxim Kozlovsky; dl-Software
> Subject:	RE: strncpy
>=20
> Max:
> To the best of my understanding, according to Jim:
> Standard: if source pointer (2nd argument) is null, the destination
> will be padded with zeros.
> Onstor: if source pointer is null, the destination will NOT be padded
> with zeros.
> I like to be aware of other differences, as there is an effort to
> change strlcpy() calls back to strncpy() calls.
> Thanks!
> -Mike
>=20
>  -----Original Message-----
> From: 	Maxim Kozlovsky =20
> Sent:	Friday, March 07, 2008 3:54 PM
> To:	Mike Lee; dl-Software
> Subject:	RE: strncpy
>=20
> Hi Mike,
>=20
> Why don't you ask Jim what difference it is? Since he mentioned it he
> should now what he is talking about.
>=20
> If you are on either Linux or BSD you are using strncpy()
> implementation comes with the OS distribution, which should be as
> standard as you can get (unless your application includes our EEE
> implementation for some masochistic purpose).
>=20
> Max
>=20
> _____________________________________________
> From: Mike Lee=20
> Sent: Friday, March 07, 2008 3:47 PM
> To: dl-Software
> Subject: strncpy
>=20
> All:
>=20
> Jim just mentioned that we have own implementation of strncpy(), which
> does not conform to the standard behavior.
> If so, would any of our old timers know what difference our own
> implemenation introduce from the standard strncpy()?
>=20
> Thanks.
> -Mike
>=20

------_=_NextPart_001_01C880AF.CB967D6C
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7653.38">
<TITLE>RE: strncpy</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Mike,</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Just looked at our =
implementation in &quot;&quot;code/sm-libc/strncpy.c&quot;&quot;:</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">char8 *</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">strncpy (</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
char8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * dst,</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const =
char8&nbsp;&nbsp;&nbsp;&nbsp; * src,</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __SIZE_TYPE__ =
n</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">)</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">{</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
*d;</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!dst || =
!src)</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (dst);</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d =3D =
dst;</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (; *src =
&amp;&amp; n; d++, src++, n--)</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *d =3D *src;</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while =
(n--)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; &lt;-----------------------------------------</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *d++ =3D '\0';&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;-----------------------------------------</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
(dst);</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* strncpy() =
*/</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Does pad to =
zeroes!</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Narain.</FONT>
</P>

<P><FONT SIZE=3D1 =
FACE=3D"Tahoma">_____________________________________________ </FONT>

<BR><B><FONT SIZE=3D1 FACE=3D"Tahoma">From: &nbsp;</FONT></B> <FONT =
SIZE=3D1 FACE=3D"Tahoma">Mike Lee&nbsp; </FONT>

<BR><B><FONT SIZE=3D1 FACE=3D"Tahoma">Sent:&nbsp;&nbsp;</FONT></B> <FONT =
SIZE=3D1 FACE=3D"Tahoma">Friday, March 07, 2008 3:57 PM</FONT>

<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">To:&nbsp;&nbsp;&nbsp;&nbsp;</FONT></B> <FONT SIZE=3D1 =
FACE=3D"Tahoma">Maxim Kozlovsky; dl-Software</FONT>

<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Subject:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Tahoma">RE: strncpy</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Max:</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">To the best of my =
understanding, according to Jim:</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Standard: if source =
pointer (2nd argument) is null, the destination will be padded with =
zeros.</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Onstor: if source =
pointer is null, the destination will NOT be padded with zeros.</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">I like to be aware =
of other differences, as there is an effort to change strlcpy() calls =
back to strncpy() calls.</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Thanks!</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">-Mike</FONT>
</P>
<UL>
<P><FONT FACE=3D"Arial"></FONT>&nbsp;<FONT SIZE=3D1 =
FACE=3D"Tahoma">-----Original Message-----</FONT>

<BR><B><FONT SIZE=3D1 FACE=3D"Tahoma">From: &nbsp;</FONT></B> <FONT =
SIZE=3D1 FACE=3D"Tahoma">Maxim Kozlovsky&nbsp; </FONT>

<BR><B><FONT SIZE=3D1 FACE=3D"Tahoma">Sent:&nbsp;&nbsp;</FONT></B> <FONT =
SIZE=3D1 FACE=3D"Tahoma">Friday, March 07, 2008 3:54 PM</FONT>

<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">To:&nbsp;&nbsp;&nbsp;&nbsp;</FONT></B> <FONT SIZE=3D1 =
FACE=3D"Tahoma">Mike Lee; dl-Software</FONT>

<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Subject:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Tahoma">RE: strncpy</FONT>
</P>

<P><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Hi Mike,</FONT>
</P>

<P><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Why don&#8217;t you =
ask Jim what difference it is? Since he mentioned it he should now what =
he is talking about.</FONT>
</P>

<P><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">If you are on either =
Linux or BSD you are using strncpy() implementation comes with the OS =
distribution, which should be as standard as you can get (unless your =
application includes our EEE implementation for some masochistic =
purpose).</FONT></P>

<P><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Max</FONT>
</P>

<P><FONT SIZE=3D2 =
FACE=3D"Tahoma">_____________________________________________<BR>
</FONT><B><FONT SIZE=3D2 FACE=3D"Tahoma">From:</FONT></B><FONT SIZE=3D2 =
FACE=3D"Tahoma"> Mike Lee<BR>
</FONT><B><FONT SIZE=3D2 FACE=3D"Tahoma">Sent:</FONT></B><FONT SIZE=3D2 =
FACE=3D"Tahoma"> Friday, March 07, 2008 3:47 PM<BR>
</FONT><B><FONT SIZE=3D2 FACE=3D"Tahoma">To:</FONT></B><FONT SIZE=3D2 =
FACE=3D"Tahoma"> dl-Software<BR>
</FONT><B><FONT SIZE=3D2 FACE=3D"Tahoma">Subject:</FONT></B><FONT =
SIZE=3D2 FACE=3D"Tahoma"> strncpy</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">All:</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Jim just mentioned that we have own =
implementation of strncpy(), which does not conform to the standard =
behavior.</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Arial">If so, would any of our old timers =
know what difference our own implemenation introduce from the standard =
strncpy()?</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks.</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Arial">-Mike</FONT>
</P>
</UL>
</BODY>
</HTML>
------_=_NextPart_001_01C880AF.CB967D6C--
