:> :Matthew: Do you remeber how your Amiga DICE-C compiler called the
:> :function described above ?
:
:> 
:>     I don't recall writing a function to do that, but I wrote DICE a long
:>     long time ago.  The DICE code is open source now, you can get it from
:>     my web site: http://apollo.backplane.com/ and try to find it :-)
:
:I just found it - the function is called |strpcpy()|:
:-- snip --
:NAME
:  stpcpy  - copy a string returning a pointer to the end of the
:destination
:
:SYNOPSIS
:  char *ptr = stpcpy(d, s);
:  char *d;
:  char *s;
:
:FUNCTION
:  Copy the nul terminated string pointed to by s to the buffer d.
:  The nul is copied.  A pointer to the nul character at the end
:  of the copied string in d is returned.
:
:NOTE
:  stpcpy() is a non-standard function.  While a stpcpy()/stpcpy()
:  combination is more efficient than a strcpy()/strcat() combination,
:...
:
:Note: This extension is already available in Linux - the only thing ToDo
:would it to port it to Solaris, write a WideChar version of it and then
:propose it to the standard bodies (which ones ?) ...
:
:----
:
:Bye,
:Roland

    Heh.  Interesting!  It looks like it originally came from Linux, back
    in the day when string scanning ops actually ate a significant amount
    of cpu.  I've included an excerpt from Apple's manual page for it from
    Darwin below.

    So I guess if you need it for linux portability... but generally
    speaking, unbounded string functions such as stpcpy() (strcpy(),
    strncpy() due to its mishandling of nul, strcat(), etc) should be
    avoided in all new code and anyone still using those functions 
    should be soundly rapped on the head.  To make code auditing easier,
    we remove all uses of such functions from our source base whenever we 
    see them, even if there is no chance of an overflow.

[from 
http://developer.apple.com/documentation/Darwin/Reference/Manpages/man3/stpcpy.3.html]

STANDARDS
     The strcpy() and strncpy() functions conform to ISO/IEC 9899:1990
     (``ISO C90'').  The stpcpy() function is an MS-DOS and GNUism.  The
     stpcpy() function conforms to no standard.

HISTORY
     The stpcpy() function first appeared in FreeBSD 4.4, coming from
     1998-vintage Linux.

                                        -Matt
                                        Matthew Dillon 
                                        <[EMAIL PROTECTED]>
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to