xref: /csrg-svn/usr.bin/window/string.h (revision 62463)
115569Sedward /*
2*62463Sbostic  * Copyright (c) 1983, 1993
3*62463Sbostic  *	The Regents of the University of California.  All rights reserved.
433514Sbostic  *
542954Sbostic  * This code is derived from software contributed to Berkeley by
642954Sbostic  * Edward Wang at The University of California, Berkeley.
742954Sbostic  *
842835Sbostic  * %sccs.include.redist.c%
933514Sbostic  *
10*62463Sbostic  *	@(#)string.h	8.1 (Berkeley) 06/06/93
1115569Sedward  */
1218752Sedward 
1315810Sedward #define STR_DEBUG
1415569Sedward 
1515569Sedward char *str_cpy();
1616287Sedward char *str_ncpy();
1715569Sedward char *str_cat();
1815569Sedward char *str_itoa();
1915569Sedward 
2015569Sedward #define str_cmp(a, b)	strcmp(a, b)
2115810Sedward 
2215810Sedward #ifdef STR_DEBUG
2315810Sedward struct string {
2415810Sedward 	struct string *s_forw;
2515810Sedward 	struct string *s_back;
2615810Sedward 	char s_data[1];
2715810Sedward };
2815810Sedward 
2915810Sedward struct string str_head;
3015810Sedward 
3115810Sedward #define str_offset ((unsigned)str_head.s_data - (unsigned)&str_head)
3215810Sedward #define str_stos(s) ((struct string *)((unsigned)(s) - str_offset))
3315810Sedward 
3415810Sedward char *str_alloc();
3515810Sedward int str_free();
3615810Sedward #else
3715810Sedward #define str_free(s)	free(s)
3815810Sedward #define str_alloc(s)	malloc(s)
3915810Sedward #endif
40