|
|
1.1 root 1: #ifndef _string_
2: #define _string_
3:
4: /* libc string routines */
5: extern char *strcat();
6: extern char *strncat();
7: extern char *strcpy();
8: extern char *strncpy();
9: extern int strlen();
10: extern int strcmp();
11: extern int strncmp();
12: extern char *strchr();
13: extern char *strrchr();
14:
15: /* extensible strings */
16: typedef struct string {
17: char *base; /* base of string */
18: char *end; /* end of allocated space+1 */
19: char *ptr; /* ptr into string */
20: } string;
21:
22: #define s_putc(s,c)\
23: if (s->ptr<s->end) *(s->ptr)++ = c; else s_grow(s,c)
24: #define s_terminate(s)\
25: if (s->ptr<s->end) *s->ptr = 0; else{ s_grow(s,0); s->ptr--; }
26: #define s_restart(s) (s->ptr = s->base , s)
27: #define s_reset(s) (s ? (*(s->ptr = s->base) = '\0' , s) : s_new())
28: #define s_clone(s) s_copy(s->ptr)
29: #define s_to_c(s) s->base
30:
31: extern string *s_new();
32: extern void s_free();
33: extern string *s_append();
34: extern string *s_nappend();
35: extern string *s_array();
36: extern string *s_copy();
37: extern string *s_seq_read();
38: extern char *s_read_line();
39: extern int s_read_to_eof();
40: extern string *s_parse();
41: /* controlling the action of s_seq_read */
42: #define TOKEN 0 /* read the next whitespace delimieted token */
43: #define LINE 1 /* read the next logical input line */
44: #define s_getline(a,b) s_seq_read(a,b,LINE)
45: #define s_gettoken(a,b) s_seq_read(a,b,TOKEN)
46:
47:
48: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.