blob: 79e994952ab1d57ba9a6d9eb4108e4e9310ddcce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/
#define import_libc
#include <iraf.h>
/* STRNCPY -- Copy exactly N characters from S2 to S1, truncating or null
** padding S2; the output string may not be null terminated if the length
** of S2 is N or more.
*/
char *
strncpy (
char *s1, /* output string */
char *s2, /* string to be moved */
int n
)
{
register char *ip, *op;
for (ip=s2, op=s1; --n >= 0 && (*op++ = *ip++); )
;
while (--n >= 0)
*op++ = '\0';
return (s1);
}
|