/*	Roast+ License
*/
#ifndef __SFJP_OPENMGL_roast_str_H__
#define __SFJP_OPENMGL_roast_str_H__

#include "roast_common.h"

__ROAST_EXTERN_C_START

/*=======================================================================*/


char* roast_strccpy( char* to, const char* from, const char c );


char* roast_strcncpy( char* to, const char* from, const char c, int n );



char* roast_strrpc1( char* buf, unsigned int bufsize, const char* find_str, const char* new_str );
char* roast_strrpc2( char* outbuf, const char* inbuf, const char* find_str, const char* rpc_str );
char* roast_safe_strrpc2( char* outbuf, unsigned int outbuf_size, const char* inbuf, const char* find_str, const char* rpc_str );
//char* roast_strrpc( char* outbuf, unsigned int outbuf_size, const char* inbuf, const char* find_str, const char* rpc_str );
#define roast_strrpc	roast_safe_strrpc2

__ROAST_EXTERN_C_END


/*=======================================================================*/

#ifdef _ROAST_REMOVE_MACRO_NS

	#define strccpy		roast_strccpy
	#define strcncpy	roast_strcncpy
	#define strrpc		roast_strrpc
	
#endif/*_ROAST_REMOVE_MACRO_NS*/



/*	嵟屻偺暥帤傪庢摼偡傞儅僋儘	*/
/*#define ROAST_LAST_CHAR(s)		(*s == '\0' ? '\0' : s[strlen(s)-1] )*/
#define ROAST_LAST_CHAR(s)			(*s == '\0' ? s[0] : s[strlen(s)-1] )		/*	2009/09/12  戙擖愭偲偟偰巜掕偝傟偨応崌偵傕懳墳乮嬻暥帤側傜s[0]乯	*/
#define ROAST_GET_LAST_CHAR(s)		ROAST_LAST_CHAR(s)
/*#define ROAST_GET_LAST_CHAR(s)	(*s == '\0' ? s[strlen(s)-1] : s[strlen(s)-1] )	*/

/*	嵟屻偺暥帤傪嶍彍	*/
#define ROAST_REMOVE_LAST_CHAR(s)	ROAST_LAST_CHAR(s) = '\0'


/*=======================================================================*/


/*	roast__memrchr	*/
#ifdef ROAST_WIN32
	void *roast__memrchr(const void *s, int c, size_t n);

	#define roast_memrchr	roast__memrchr

#else /* UNIX/Linux */
	#define roast_memrchr	memrchr

#endif



/*仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭仩仭*/


#endif/*__SFJP_OPENMGL_roast_str_H__*/
