Subversion Repositories HelenOS-historic

Rev

Rev 517 | Rev 532 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 517 Rev 518
Line 80... Line 80...
80
 * @param len Maximal length for comparison.
80
 * @param len Maximal length for comparison.
81
 *
81
 *
82
 * @return 0 if the strings are equal, 1 otherwise.
82
 * @return 0 if the strings are equal, 1 otherwise.
83
 *
83
 *
84
 */
84
 */
85
int strcmp(const char *src, const char *dst, size_t len)
85
int strncmp(const char *src, const char *dst, size_t len)
86
{
86
{
87
    int i;
87
    int i;
88
   
88
   
89
    i = 0;
89
    i = 0;
90
    while ((i < len) && (src[i] == dst[i])) {
90
    while ((i < len) && (src[i] == dst[i])) {
Line 93... Line 93...
93
        i++;
93
        i++;
94
    }
94
    }
95
    return 1;
95
    return 1;
96
}
96
}
97
 
97
 
-
 
98
/** Copy NULL terminated string.
-
 
99
 *
-
 
100
 * Copy at most 'len' characters from string 'src' to 'dest'.
-
 
101
 * If 'src' is shorter than 'len', '\0' is inserted behind the
-
 
102
 * last copied character.
-
 
103
 *
-
 
104
 * @param src Source string.
-
 
105
 * @param dst Destination buffer.
-
 
106
 * @param len Size of destination buffer.
-
 
107
 */
-
 
108
void strncpy(char *dest, const char *src, size_t len)
-
 
109
{
-
 
110
    int i;
-
 
111
    for (i = 0; i < len; i++) {
-
 
112
        if (!(dest[i] = src[i]))
-
 
113
            return;
-
 
114
    }
-
 
115
}