|
|
1.1 root 1: /* @(#)string.c 1.4 */
2: /*
3: * UNIX shell
4: *
5: * Bell Telephone Laboratories
6: *
7: */
8:
9: #include "defs.h"
10:
11:
12: /* ======== general purpose string handling ======== */
13:
14:
15: char *
16: movstr(a, b)
17: register char *a, *b;
18: {
19: while (*b++ = *a++);
20: return(--b);
21: }
22:
23: any(c, s)
24: register char c;
25: char *s;
26: {
27: register char d;
28:
29: while (d = *s++)
30: {
31: if (d == c)
32: return(TRUE);
33: }
34: return(FALSE);
35: }
36:
37: cf(s1, s2)
38: register char *s1, *s2;
39: {
40: while (*s1++ == *s2)
41: if (*s2++ == 0)
42: return(0);
43: return(*--s1 - *s2);
44: }
45:
46: length(as)
47: char *as;
48: {
49: register char *s;
50:
51: if (s = as)
52: while (*s++);
53: return(s - as);
54: }
55:
56: char *
57: movstrn(a, b, n)
58: register char *a, *b;
59: register int n;
60: {
61: while ((n-- > 0) && *a)
62: *b++ = *a++;
63:
64: return(b);
65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.