aboutsummaryrefslogtreecommitdiff
path: root/sys/fmtio/gstrcpy.x
blob: e2d6e7b1f6f392f8a164f19daa8bb1470c6019a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# GSTRCPY -- Copy string s1 to s2, return the number of characters copied.

int procedure gstrcpy (s1, s2, maxch)

char	s1[ARB], s2[ARB]
int	maxch, i

begin
	do i = 1, maxch {
	    s2[i] = s1[i]
	    if (s2[i] == EOS)
		return (i - 1)
	}

	s2[maxch+1] = EOS
	return (maxch)
end