1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Edward Wang at The University of California, Berkeley. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)string.h 8.1 (Berkeley) 06/06/93 11 */ 12 13 #define STR_DEBUG 14 15 char *str_cpy(); 16 char *str_ncpy(); 17 char *str_cat(); 18 char *str_itoa(); 19 20 #define str_cmp(a, b) strcmp(a, b) 21 22 #ifdef STR_DEBUG 23 struct string { 24 struct string *s_forw; 25 struct string *s_back; 26 char s_data[1]; 27 }; 28 29 struct string str_head; 30 31 #define str_offset ((unsigned)str_head.s_data - (unsigned)&str_head) 32 #define str_stos(s) ((struct string *)((unsigned)(s) - str_offset)) 33 34 char *str_alloc(); 35 int str_free(); 36 #else 37 #define str_free(s) free(s) 38 #define str_alloc(s) malloc(s) 39 #endif 40