|
|
1.1 root 1: /*
2: * @(#)common.c 1.1 86/02/03 Copyright (c) 1985 by Sun Microsystems, Inc.
3: */
4:
5: /*
6: * Common code for various bootstrap routines.
7: */
8:
9: bzero(p, n)
10: register char *p;
11: register int n;
12: {
13: register char zeero = 0;
14:
15: while (n > 0)
16: *p++ = zeero, n--; /* Avoid clr for 68000, still... */
17: }
18:
19: bcopy(src, dest, count)
20: register char *src, *dest;
21: register int count;
22: {
23: while (--count != -1)
24: *dest++ = *src++;
25: }
26:
27: /*
28: * Compare strings: s1>s2: >0 s1==s2: 0 s1<s2: <0
29: */
30: strcmp(s1, s2)
31: register char *s1, *s2;
32: {
33:
34: while (*s1 == *s2++)
35: if (*s1++=='\0')
36: return (0);
37: return (*s1 - *--s2);
38: }
39:
40: /*
41: * Returns the number of
42: * non-NULL bytes in string argument.
43: */
44: strlen(s)
45: register char *s;
46: {
47: register int n;
48:
49: n = 0;
50: while (*s++)
51: n++;
52: return (n);
53: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.