lcrzo_string(3)

NAME
lcrzo_string - lcrzo library : string manipulation

CONTENTS
/*    Laurent Constantin's network library (lcrzo)
                 lcrzo_string module
  Functions herein allow to work on strings.
*/
/*-------------------------------------------------------------*/
/**********************************************
 * Note about sizes :                         *
 *   sizes are always in bytes                *
 **********************************************/
/*-------------------------------------------------------------*/
int lcrzo_string_alloc(lcrzo_int32 allocsize, lcrzo_string *pptr);
int lcrzo_string_realloc(lcrzo_int32 newallocsize, lcrzo_string *pptr);
int lcrzo_string_free2(lcrzo_string *pptr);
/*-------------------------------------------------------------*/
/**********************************************
 * Note about indexes :                       *
 * Indexes permit to access range of data.    *
 * For example, if we have a 4 bytes data,    *
 * containing 'ABCD', we can represent it     *
 * like this :                                *
 *       +---+---+---+---+---+                *
 *       | A | B | C | D | \0|                *
 *       +---+---+---+---+---+                *
 * The indexes are associated with the        *
 * corners :                                  *
 *       1   2   3   4   5                    *
 *      -5  -4  -3  -2  -1                    *
 * So :                                       *
 *   range [1,5]   is 'ABCD'                  *
 *   range [2,3]   is 'B'                     *
 *   range [3,3]   is ''     (empty array)    *
 *   range [1,-1]  is 'ABCD'                  *
 *   range [2,-3]  is 'B'                     *
 *   range [3,1]   is 'BA'                    *
 *   range [-1,1]  is 'DCBA'                  *
 *   range [-2,-3] is 'C'                     *
 *   etc.                                     *
 * Note : 0 (zero) is an invalid index        *
 **********************************************/
/*-------------------------------------------------------------*/
/* functions in this module have the same meaning
   than those in the lcrzo_data module (except they work
   on strings).
   In a next version of lcrzo, I'll take time to comment this
   Module.
*/
/*-------------------------------------------------------------*/
int lcrzo_string_init_data(lcrzo_constdata datain,
			   lcrzo_int32 datainsize,
			   lcrzo_int32 stringoutmaxsize,
			   lcrzo_string stringout);
int lcrzo_string_initm_data(lcrzo_constdata datain,
			    lcrzo_int32 datainsize,
			    lcrzo_string *pstringout);
int lcrzo_string_append_data(lcrzo_constdata datain,
			     lcrzo_int32 datainsize,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_appendm_data(lcrzo_constdata datain,
			      lcrzo_int32 datainsize,
			      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_range(lcrzo_conststring stringin,
			    lcrzo_int32 stringinstartpos,
			    lcrzo_int32 stringinendpos,
			    lcrzo_int32 stringoutmaxsize,
			    lcrzo_string stringout);
int lcrzo_string_initm_range(lcrzo_conststring stringin,
			     lcrzo_int32 stringinstartpos,
			     lcrzo_int32 stringinendpos,
			     lcrzo_string *pstringout);
int lcrzo_string_append_range(lcrzo_conststring stringin,
			      lcrzo_int32 stringinstartpos,
			      lcrzo_int32 stringinendpos,
			      lcrzo_int32 stringoutmaxsize,
			      lcrzo_string stringout);
int lcrzo_string_appendm_range(lcrzo_conststring stringin,
			       lcrzo_int32 stringinstartpos,
			       lcrzo_int32 stringinendpos,
			       lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_fill(lcrzo_conststring stringin,
			   lcrzo_int32 fillingsize,
			   lcrzo_int32 stringoutmaxsize,
			   lcrzo_string stringout);
int lcrzo_string_initm_fill(lcrzo_conststring stringin,
			    lcrzo_int32 fillingsize,
			    lcrzo_string *pstringout);
int lcrzo_string_append_fill(lcrzo_conststring stringin,
			     lcrzo_int32 fillingsize,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_appendm_fill(lcrzo_conststring stringin,
			      lcrzo_int32 fillingsize,
			      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_char(lcrzo_uint8 c,
			   lcrzo_int32 fillingsize,
			   lcrzo_int32 stringoutmaxsize,
			   lcrzo_string stringout);
int lcrzo_string_initm_char(lcrzo_uint8 c,
			    lcrzo_int32 fillingsize,
			    lcrzo_string *pstringout);
int lcrzo_string_append_char(lcrzo_uint8 c,
			     lcrzo_int32 fillingsize,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_appendm_char(lcrzo_uint8 c,
			      lcrzo_int32 fillingsize,
			      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_rand(lcrzo_uint8 minvalue,
			   lcrzo_uint8 maxvalue,
			   lcrzo_int32 fillingsize,
			   lcrzo_int32 stringoutmaxsize,
			   lcrzo_string stringout);
int lcrzo_string_initm_rand(lcrzo_uint8 minvalue,
			    lcrzo_uint8 maxvalue,
			    lcrzo_int32 fillingsize,
			    lcrzo_string *pstringout);
int lcrzo_string_append_rand(lcrzo_uint8 minvalue,
			     lcrzo_uint8 maxvalue,
			     lcrzo_int32 fillingsize,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_appendm_rand(lcrzo_uint8 minvalue,
			      lcrzo_uint8 maxvalue,
			      lcrzo_int32 fillingsize,
			      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_int(lcrzo_int32 integer,
			  lcrzo_conststring format,
			  lcrzo_int32 stringoutmaxsize,
			  lcrzo_string stringout);
int lcrzo_string_initm_int(lcrzo_int32 integer,
			   lcrzo_conststring format,
			   lcrzo_string *pstringout);
int lcrzo_string_append_int(lcrzo_int32 integer,
			    lcrzo_conststring format,
			    lcrzo_int32 stringoutmaxsize,
			    lcrzo_string stringout);
int lcrzo_string_appendm_int(lcrzo_int32 integer,
			     lcrzo_conststring format,
			     lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_text(lcrzo_conststring text,
			   lcrzo_int32 stringoutmaxsize,
			   lcrzo_string stringout);
int lcrzo_string_initm_text(lcrzo_conststring text,
			    lcrzo_string *pstringout);
int lcrzo_string_append_text(lcrzo_conststring text,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_appendm_text(lcrzo_conststring text,
			      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_coretext(lcrzo_conststring text,
			       lcrzo_int32 stringoutmaxsize,
			       lcrzo_string stringout);
int lcrzo_string_initm_coretext(lcrzo_conststring text,
				lcrzo_string *pstringout);
int lcrzo_string_append_coretext(lcrzo_conststring text,
				 lcrzo_int32 stringoutmaxsize,
				 lcrzo_string stringout);
int lcrzo_string_appendm_coretext(lcrzo_conststring text,
				  lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_hexa(lcrzo_consthexa hexa,
			   lcrzo_int32 stringoutmaxsize,
			   lcrzo_string stringout);
int lcrzo_string_initm_hexa(lcrzo_consthexa hexa,
			    lcrzo_string *pstringout);
int lcrzo_string_append_hexa(lcrzo_consthexa hexa,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_appendm_hexa(lcrzo_consthexa hexa,
			      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_mixed(lcrzo_constmixed mixed,
			    lcrzo_int32 stringoutmaxsize,
			    lcrzo_string stringout);
int lcrzo_string_initm_mixed(lcrzo_constmixed mixed,
			     lcrzo_string *pstringout);
int lcrzo_string_append_mixed(lcrzo_constmixed mixed,
			      lcrzo_int32 stringoutmaxsize,
			      lcrzo_string stringout);
int lcrzo_string_appendm_mixed(lcrzo_constmixed mixed,
			       lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_init_base64(lcrzo_constbase64 base64,
			     lcrzo_int32 stringoutmaxsize,
			     lcrzo_string stringout);
int lcrzo_string_initm_base64(lcrzo_constbase64 base64,
			      lcrzo_string *pstringout);
int lcrzo_string_append_base64(lcrzo_constbase64 base64,
			       lcrzo_int32 stringoutmaxsize,
			       lcrzo_string stringout);
int lcrzo_string_appendm_base64(lcrzo_constbase64 base64,
				lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_text_stdin(lcrzo_conststring message,
				  lcrzo_conststring defaulttext,
				  lcrzo_string *pstringout);
int lcrzo_string_appendm_text_stdin(lcrzo_conststring message,
				    lcrzo_conststring defaulttext,
				    lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_coretext_stdin(lcrzo_conststring message,
				      lcrzo_conststring defaultcoretext,
				      lcrzo_string *pstringout);
int lcrzo_string_appendm_coretext_stdin(lcrzo_conststring message,
					lcrzo_conststring defaultcoretext,
					lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_text_passwd(lcrzo_conststring message,
				   lcrzo_conststring defaulttext,
				   lcrzo_string *pstringout);
int lcrzo_string_appendm_text_passwd(lcrzo_conststring message,
				     lcrzo_conststring defaulttext,
				     lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_coretext_passwd(lcrzo_conststring message,
				       lcrzo_conststring defaultcoretext,
				       lcrzo_string *pstringout);
int lcrzo_string_appendm_coretext_passwd(lcrzo_conststring message,
					 lcrzo_conststring defaultcoretext,
					 lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_hexa_stdin(lcrzo_conststring message,
				  lcrzo_consthexa defaulthexa,
				  lcrzo_string *pstringout);
int lcrzo_string_appendm_hexa_stdin(lcrzo_conststring message,
				    lcrzo_consthexa defaulthexa,
				    lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_mixed_stdin(lcrzo_conststring message,
				   lcrzo_constmixed defaultmixed,
				   lcrzo_string *pstringout);
int lcrzo_string_appendm_mixed_stdin(lcrzo_conststring message,
				     lcrzo_constmixed defaultmixed,
				     lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_initm_base64_stdin(lcrzo_conststring message,
				    lcrzo_constbase64 defaultbase64,
				    lcrzo_string *pstringout);
int lcrzo_string_appendm_base64_stdin(lcrzo_conststring message,
				      lcrzo_constbase64 defaultbase64,
				      lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_string_search_char(lcrzo_conststring stringin,
			     lcrzo_bool searchcomplement,
			     lcrzo_int32 stringinstartpos,
			     lcrzo_int32 stringinendpos,
			     lcrzo_uint8 c,
			     lcrzo_int32 *pfoundposition_negative,
			     lcrzo_int32 *pfoundposition_positive);
int lcrzo_string_search_nchar(lcrzo_conststring stringin,
			      lcrzo_bool searchcomplement,
			      lcrzo_int32 stringinstartpos,
			      lcrzo_int32 stringinendpos,
			      lcrzo_conststring searchlist,
			      lcrzo_int32 *pfoundposition_negative,
			      lcrzo_int32 *pfoundposition_positive);
int lcrzo_string_search_text(lcrzo_conststring stringin,
			     lcrzo_bool searchcomplement,
			     lcrzo_int32 stringinstartpos,
			     lcrzo_int32 stringinendpos,
			     lcrzo_conststring searchedtext,
			     lcrzo_int32 *pstartfoundposition_negative,
			     lcrzo_int32 *pstartfoundposition_positive,
			     lcrzo_int32 *pendfoundposition_negative,
			     lcrzo_int32 *pendfoundposition_positive);
int lcrzo_string_search_re(lcrzo_conststring stringin,
			   lcrzo_bool searchcomplement,
			   lcrzo_int32 stringinstartpos,
			   lcrzo_int32 stringinendpos,
			   lcrzo_conststring regularexpression,
			   lcrzo_int32 *pstartfoundposition_negative,
			   lcrzo_int32 *pstartfoundposition_positive,
			   lcrzo_int32 *pendfoundposition_negative,
			   lcrzo_int32 *pendfoundposition_positive);
int lcrzo_string_search_regexp(lcrzo_conststring stringin,
			       lcrzo_bool searchcomplement,
			       lcrzo_int32 stringinstartpos,
			       lcrzo_int32 stringinendpos,
			       lcrzo_conststring regularexpression,
			       lcrzo_regexp arrayfoundpos);
/*-------------------------------------------------------------*/
int lcrzo_string_token_char(lcrzo_conststring stringin,
			    lcrzo_bool searchcomplement,
			    lcrzo_int32 stringinstartpos,
			    lcrzo_int32 stringinendpos,
			    lcrzo_uint8 c,
			    lcrzo_int32 *ppositionindicator,
			    lcrzo_int32 *pstartfoundposition_negative,
			    lcrzo_int32 *pstartfoundposition_positive,
			    lcrzo_int32 *pendfoundposition_negative,
			    lcrzo_int32 *pendfoundposition_positive);
int lcrzo_string_token_nchar(lcrzo_conststring stringin,
			     lcrzo_bool searchcomplement,
			     lcrzo_int32 stringinstartpos,
			     lcrzo_int32 stringinendpos,
			     lcrzo_conststring searchlist,
			     lcrzo_int32 *ppositionindicator,
			     lcrzo_int32 *pstartfoundposition_negative,
			     lcrzo_int32 *pstartfoundposition_positive,
			     lcrzo_int32 *pendfoundposition_negative,
			     lcrzo_int32 *pendfoundposition_positive);
int lcrzo_string_token_text(lcrzo_conststring stringin,
			    lcrzo_bool searchcomplement,
			    lcrzo_int32 stringinstartpos,
			    lcrzo_int32 stringinendpos,
			    lcrzo_conststring searchedtext,
			    lcrzo_int32 *ppositionindicator,
			    lcrzo_int32 *pstartfoundposition_negative,
			    lcrzo_int32 *pstartfoundposition_positive,
			    lcrzo_int32 *pendfoundposition_negative,
			    lcrzo_int32 *pendfoundposition_positive);
int lcrzo_string_token_re(lcrzo_conststring stringin,
			  lcrzo_bool searchcomplement,
			  lcrzo_int32 stringinstartpos,
			  lcrzo_int32 stringinendpos,
			  lcrzo_conststring regularexpression,
			  lcrzo_int32 *ppositionindicator,
			  lcrzo_int32 *pstartfoundposition_negative,
			  lcrzo_int32 *pstartfoundposition_positive,
			  lcrzo_int32 *pendfoundposition_negative,
			  lcrzo_int32 *pendfoundposition_positive);
/*-------------------------------------------------------------*/
int lcrzo_string_replacem_char(lcrzo_conststring stringin,
			       lcrzo_bool searchcomplement,
			       lcrzo_int32 stringinstartpos,
			       lcrzo_int32 stringinendpos,
			       lcrzo_int32 maxnumberofreplacement,
			       lcrzo_uint8 c_toreplace,
			       lcrzo_conststring string_replacing,
			       lcrzo_string *pstringout);
int lcrzo_string_replacem_nchar(lcrzo_conststring stringin,
				lcrzo_bool searchcomplement,
				lcrzo_int32 stringinstartpos,
				lcrzo_int32 stringinendpos,
				lcrzo_int32 maxnumberofreplacement,
				lcrzo_conststring searchlist,
				lcrzo_conststring string_replacing,
				lcrzo_string *pstringout);
int lcrzo_string_replacem_text(lcrzo_conststring stringin,
			       lcrzo_bool searchcomplement,
			       lcrzo_int32 stringinstartpos,
			       lcrzo_int32 stringinendpos,
			       lcrzo_int32 maxnumberofreplacement,
			       lcrzo_conststring searchedtext,
			       lcrzo_conststring string_replacing,
			       lcrzo_string *pstringout);
int lcrzo_string_replacem_re(lcrzo_conststring stringin,
			     lcrzo_bool searchcomplement,
			     lcrzo_int32 stringinstartpos,
			     lcrzo_int32 stringinendpos,
			     lcrzo_int32 maxnumberofreplacement,
			     lcrzo_conststring regularexpression,
			     lcrzo_conststring string_replacing,
			     lcrzo_string *pstringout);
int lcrzo_string_replacem_regexp(lcrzo_conststring stringin,
				 lcrzo_bool searchcomplement,
				 lcrzo_int32 stringinstartpos,
				 lcrzo_int32 stringinendpos,
				 lcrzo_int32 maxnumberofreplacement,
				 lcrzo_conststring regularexpression,
				 lcrzo_conststring string_replacing,
				 lcrzo_string *pstringout);
/*-------------------------------------------------------------*/
int lcrzo_hexa_initm_string(lcrzo_conststring stringin,
			    lcrzo_hexa *phexaout);
int lcrzo_mixed_initm_string(lcrzo_conststring stringin,
			     lcrzo_mixed *pmixedout);
int lcrzo_base64_initm_string(lcrzo_conststring stringin,
			      lcrzo_base64 *pbase64out);

SEE ALSO
lcrzo(3), lcrzo_types(3), lcrzo_data(3), lcrzo_string(3), lcrzo_time(3), lcrzo_file(3), lcrzo_address(3), lcrzo_device(3), lcrzo_list(3), lcrzo_process(3), lcrzo_ipc(3), lcrzo_header(3), lcrzo_ipopt(3), lcrzo_tcpopt(3), lcrzo_packet(3), lcrzo_icmp(3), lcrzo_print(3), lcrzo_record(3), lcrzo_conf(3), lcrzo_spoof(3), lcrzo_sniff(3), lcrzo_sock(3), lcrzo_wait(3), lcrzo_global(3), lcrzo_error(3) lcrzo_misc(3), lcrzo_obso(3),