Rev 6934 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6934 | Rev 6936 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | #include |
26 | #include |
27 | #include |
27 | #include |
28 | #include |
28 | #include |
Line -... | Line 29... | ||
- | 29 | ||
- | 30 | ||
- | 31 | #ifndef __HAVE_ARCH_STRNCPY |
|
- | 32 | /** |
|
- | 33 | * strncpy - Copy a length-limited, C-string |
|
- | 34 | * @dest: Where to copy the string to |
|
- | 35 | * @src: Where to copy the string from |
|
- | 36 | * @count: The maximum number of bytes to copy |
|
- | 37 | * |
|
- | 38 | * The result is not %NUL-terminated if the source exceeds |
|
- | 39 | * @count bytes. |
|
- | 40 | * |
|
- | 41 | * In the case where the length of @src is less than that of |
|
- | 42 | * count, the remainder of @dest will be padded with %NUL. |
|
- | 43 | * |
|
- | 44 | */ |
|
- | 45 | char *strncpy(char *dest, const char *src, size_t count) |
|
- | 46 | { |
|
- | 47 | char *tmp = dest; |
|
- | 48 | ||
- | 49 | while (count) { |
|
- | 50 | if ((*tmp = *src) != 0) |
|
- | 51 | src++; |
|
- | 52 | tmp++; |
|
- | 53 | count--; |
|
- | 54 | } |
|
- | 55 | return dest; |
|
- | 56 | } |
|
Line 29... | Line 57... | ||
29 | 57 | EXPORT_SYMBOL(strncpy); |
|
30 | 58 | #endif |
|
31 | 59 | ||
32 | #ifndef __HAVE_ARCH_STRLCPY |
60 | #ifndef __HAVE_ARCH_STRLCPY |