Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / libcc.ansi / string / strxfrm.c
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  */
5 /* $Id: strxfrm.c,v 1.5 1994/06/24 11:57:25 ceriel Exp $ */
6
7 #include        <string.h>
8
9 size_t
10 strxfrm(register char *s1, register const char *save, register size_t n)
11 {
12         register const char *s2 = save;
13
14         while (*s2) {
15                 if (n > 1) {
16                         n--;
17                         *s1++ = *s2++;
18                 } else
19                         s2++;
20         }
21         if (n > 0)
22                 *s1++ = '\0';
23         return s2 - save;
24 }