Changeset 1736 for Whitix/branches

Show
Ignore:
Timestamp:
12/30/08 15:46:29 (3 years ago)
Author:
mwhitworth
Message:

Add strncat function.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/keobject/lib/string.c

    r1446 r1736  
    114114SYMBOL_EXPORT(strcat); 
    115115 
     116char* strncat(char* dest, const char* src, size_t count) 
     117{ 
     118        char* tmp = dest; 
     119         
     120        if (count) 
     121        { 
     122                while (*dest) 
     123                        dest++; 
     124                         
     125                while ((*dest++ = *src++)) 
     126                { 
     127                        if (!--count) 
     128                        { 
     129                                *dest = '\0'; 
     130                                break; 
     131                        } 
     132                } 
     133        } 
     134         
     135        return tmp; 
     136} 
     137 
     138SYMBOL_EXPORT(strncat); 
     139 
    116140char* strchr(char* string,int c) 
    117141{