1 /*
2 * This file belongs to FreeMiNT. It's not in the original MiNT 1.12
3 * distribution. See the file CHANGES for a detailed log of changes.
4 *
5 *
6 * Copyright 2000 Frank Naumann <fnaumann@freemint.de>
7 * All rights reserved.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This file is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 *
24 * begin: 2000-04-17
25 * last change: 2000-04-17
26 *
27 * Author: Frank Naumann <fnaumann@freemint.de>
28 *
29 * Please send suggestions, patches or bug reports to me or
30 * the MiNT mailing list.
31 *
32 *
33 * changes since last version:
34 *
35 * known bugs:
36 *
37 * todo:
38 *
39 * optimizations:
40 *
41 */
42
43 #include "mint/kcompiler.h"
44 #include "mint/string.h"
45
46
47 char * _cdecl
strncpy(char * dst,const char * src,long len)48 strncpy (char *dst, const char *src, long len)
49 {
50 register char *_dst = dst;
51
52 while (--len >= 0 && (*_dst++ = *src++) != 0)
53 continue;
54
55 while (--len >= 0)
56 *_dst++ = 0;
57
58 return dst;
59 }
60