source: trunk/minix/lib/ack/libp/string.c@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.1 KB
RevLine 
[9]1/* $Header: /cvsup/minix/src/lib/ack/libp/string.c,v 1.1 2005/10/10 15:27:47 beng Exp $ */
2/*
3 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 *
5 * This product is part of the Amsterdam Compiler Kit.
6 *
7 * Permission to use, sell, duplicate or disclose this software must be
8 * obtained in writing. Requests for such permissions may be sent to
9 *
10 * Dr. Andrew S. Tanenbaum
11 * Wiskundig Seminarium
12 * Vrije Universiteit
13 * Postbox 7161
14 * 1007 MC Amsterdam
15 * The Netherlands
16 *
17 */
18
19/* function strbuf(var b:charbuf):string; */
20
21char *strbuf(s) char *s; {
22 return(s);
23}
24
25/* function strtobuf(s:string; var b:charbuf; blen:integer):integer; */
26
27int strtobuf(s,b,l) char *s,*b; {
28 int i;
29
30 i = 0;
31 while (--l>=0) {
32 if ((*b++ = *s++) == 0)
33 break;
34 i++;
35 }
36 return(i);
37}
38
39/* function strlen(s:string):integer; */
40
41int strlen(s) char *s; {
42 int i;
43
44 i = 0;
45 while (*s++)
46 i++;
47 return(i);
48}
49
50/* function strfetch(s:string; i:integer):char; */
51
52int strfetch(s,i) char *s; {
53 return(s[i-1]);
54}
55
56/* procedure strstore(s:string; i:integer; c:char); */
57
58strstore(s,i,c) char *s; {
59 s[i-1] = c;
60}
Note: See TracBrowser for help on using the repository browser.