*/
*Header: pstring.h (string handling support)
* by Martin.Weitzel@rent-a-guru.DE
*/
#ifndef PSTRING_H
#define PSTRING_H
/*
* Interface macros to "pstr_x" for fixed number of
* arguments. (Using this macros instead of direct
* calls to the function helps to make the source
* more readable.)
*/
char *pstr_x(conts char *str, ...);
#define pstr_1(s1)\
(pstr_x(s1, (const char *)0))
#define pstr_2(s1, s2)\
(pstr_x(s1, s2 (const char *)0))
#define pstr_3(s1, s2, s3)\
(pstr_x(s1, s2, s3, (const char *)0))
#define pstr_4(s1, s2, s3, s4)\
(pstr_x(s1, s2, s3, s4 (const char *)0))
/* .... may be extended .... */
/*
* Strings that are used only once may be build with
* help of the "tmpstr"-function or (preferably) with
* one of the "TMPSTR"-macros. The space occupied by
* a string build in this way is freed with the next
* call to one of this macros, so its contents should
* be accessed IMMEDIATELY. To reduce the risk of
* inappropriate use, the result of calls to "tmpstr"
* should NEVER be strored into a pointer, and when
* calling a function that needs several string
* arguments. AT MOST ONE may be initialized with the
* result of a call to "tmpstr". In both cases this
* includes indirect calls to "tmpstr" through one of
* the "TMPSTR"-macros.
*/
char *tmpstr(char *str);
#define TMPSTR1(s1)\
(tmpstr(pstr_1(s1)))
#define TMPSTR2(s1, s2)\
(tmpstr(pstr_2(s1, s2)))
#define TMPSTR3(s1, s2, s3)\
(tmpstr(pstr_3(s1, s2, s3)))
#define TMPSTR4(s1, s2, s3, s4)\
(tmpstr(pstr_4(s1, s2, s3, s4)))
/* .... may be extended .... */
#endif