Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/strncpy.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 316 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 /*
2 * strncpy.c
3 */
4
5 #include <string.h>
6
7 char *strncpy(char *dst, const char *src, size_t n)
8 {
9 char *q = dst;
10 const char *p = src;
11 char ch;
12
13 while (n) {
14 n--;
15 *q++ = ch = *p++;
16 if (!ch)
17 break;
18 }
19
20 /* The specs say strncpy() fills the entire buffer with NUL. Sigh. */
21 memset(q, 0, n);
22
23 return dst;
24 }