Annotation of libelwix/inc/elwix/astr.h, revision 1.7.10.1

1.1       misho       1: /*************************************************************************
                      2: * (C) 2013 AITNET ltd - Sofia/Bulgaria - <misho@aitnet.org>
                      3: *  by Michael Pounov <misho@elwix.org>
                      4: *
                      5: * $Author: misho $
1.7.10.1! misho       6: * $Id: astr.h,v 1.7 2018/05/31 15:35:16 misho Exp $
1.1       misho       7: *
                      8: **************************************************************************
                      9: The ELWIX and AITNET software is distributed under the following
                     10: terms:
                     11: 
                     12: All of the documentation and software included in the ELWIX and AITNET
                     13: Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
                     14: 
1.7.10.1! misho      15: Copyright 2004 - 2019
1.1       misho      16:        by Michael Pounov <misho@elwix.org>.  All rights reserved.
                     17: 
                     18: Redistribution and use in source and binary forms, with or without
                     19: modification, are permitted provided that the following conditions
                     20: are met:
                     21: 1. Redistributions of source code must retain the above copyright
                     22:    notice, this list of conditions and the following disclaimer.
                     23: 2. Redistributions in binary form must reproduce the above copyright
                     24:    notice, this list of conditions and the following disclaimer in the
                     25:    documentation and/or other materials provided with the distribution.
                     26: 3. All advertising materials mentioning features or use of this software
                     27:    must display the following acknowledgement:
                     28: This product includes software developed by Michael Pounov <misho@elwix.org>
                     29: ELWIX - Embedded LightWeight unIX and its contributors.
                     30: 4. Neither the name of AITNET nor the names of its contributors
                     31:    may be used to endorse or promote products derived from this software
                     32:    without specific prior written permission.
                     33: 
                     34: THIS SOFTWARE IS PROVIDED BY AITNET AND CONTRIBUTORS ``AS IS'' AND
                     35: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     36: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     37: ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     38: FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     39: DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     40: OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     41: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     42: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     43: OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     44: SUCH DAMAGE.
                     45: */
                     46: #ifndef __ASTR_H
                     47: #define __ASTR_H
                     48: 
                     49: 
                     50: /*
                     51:  * str_FreeNullTerm() - Free dynamic allocated null terminated array with strings
                     52:  *
                     53:  * @arr = Pointer to array for free
                     54:  * return: none
                     55:  */
1.3       misho      56: void str_FreeNullTerm(char *** __restrict arr);
1.1       misho      57: /*
                     58:  * str_ArgsNum() - Parse and calculate number of arguments
                     59:  *
                     60:  * @csArgs = Input arguments line
                     61:  * @csDelim = Delimiter(s) for separate
                     62:  * return: 0 error format; -1 error:: can`t read; >0 ok, number of items
                     63:  */
1.3       misho      64: int str_ArgsNum(const char *csArgs, const char *csDelim);
1.1       misho      65: /*
                     66:  * str_ExecArgs() - Build exec arguments from other array
                     67:  *
                     68:  * @psProg = Program name for execute
                     69:  * @oldarg = Arguments array
                     70:  * return: NULL error; !=NULL Allocated execution array(must be e_free)
                     71:  */
                     72: char **str_ExecArgs(const char *psProg, const char **oldarg);
                     73: /*
                     74:  * str_CopyEnv() - Copy environment to new environment array;
                     75:  *
                     76:  * @oldenv = Environment array
                     77:  * return: NULL error; !=NULL Allocated new environment array(must be e_free)
                     78:  */
                     79: char **str_CopyEnv(const char **oldenv);
                     80: 
                     81: /*
                     82:  * str_Ast() - Function for evaluate string like asterisk variable "{text[:[-]#[:#]]}"
                     83:  *
                     84:  * @csString = Input string
                     85:  * return: NULL error, !=NULL Allocated new string evaluated from input string, 
                     86:  *             must be ait_freeVar()
                     87:  */
                     88: ait_val_t *str_Ast(const char *csString);
                     89: 
                     90: /*
                     91:  * str_LTrim() - Remove left whitespaces from text string
                     92:  *
                     93:  * @psLine = Text string
                     94:  * return: 0 nothing to do; !=0 Removed bytes
                     95:  */
1.3       misho      96: int str_LTrim(char * __restrict psLine);
1.1       misho      97: /*
                     98:  * str_RTrim() - Remove right whitespaces from text string
                     99:  *
                    100:  * @psLine = Text string
                    101:  * return: 0 nothing to do; !=0 Removed bytes
                    102:  */
1.3       misho     103: int str_RTrim(char * __restrict psLine);
1.1       misho     104: /*
                    105:  * str_Trim() - Remove left and right whitespaces from text string
                    106:  *
                    107:  * @psLine = Text string
                    108:  * return: 0 nothing to do; !=0 Removed bytes
                    109:  */
1.3       misho     110: int str_Trim(char * __restrict psLine);
1.1       misho     111: /*
                    112:  * str_Unquot() - Remove quots from input text string 
                    113:  *
                    114:  * @psLine = Text string
                    115:  * return: 0 nothing to do; 1 successful unquoted string
                    116:  */
1.3       misho     117: int str_Unquot(char * __restrict psLine);
1.2       misho     118: /*
                    119:  * str_Upper() - Convert all lower characters to upper
                    120:  *
                    121:  * @psLine = Text string
                    122:  * return: 0 nothing to do; !=0 converted chars
                    123:  */
1.3       misho     124: int str_Upper(char * __restrict psLine);
1.2       misho     125: /*
                    126:  * str_Lower() - Convert all upper characters to lower
                    127:  *
                    128:  * @psLine = Text string
                    129:  * return: 0 nothing to do; !=0 converted chars
                    130:  */
1.3       misho     131: int str_Lower(char * __restrict psLine);
1.1       misho     132: 
                    133: /*
                    134:  * str_Hex2Dig() - Convert from Hex string to digit array
                    135:  *
                    136:  * @psLine = Text string
                    137:  * return: NULL nothing to do or error; 
                    138:  *             !=0 Allocated new converted data (must be ait_freeVar())
                    139:  */
                    140: ait_val_t *str_Hex2Dig(const char *psLine);
                    141: /*
                    142:  * str_Dig2Hex() - Convert from digit array to Hex string
                    143:  *
                    144:  * @digz = Digits
                    145:  * return: NULL nothing to do or error; 
                    146:  *             !=0 Allocated new converted string (must be e_free())
                    147: */
                    148: char *str_Dig2Hex(ait_val_t *digz);
1.7.10.1! misho     149: /*
        !           150:  * str_Dig2Hex2() - Convert from digit array to Hex string
        !           151:  *
        !           152:  * @digz = Digits array
        !           153:  * @diglen = Array length
        !           154:  * return: NULL nothing to do or error; 
        !           155:  *             !=0 Allocated new converted string (must be e_free())
        !           156: */
        !           157: char *str_Dig2Hex2(u_char *digz, int diglen);
1.1       misho     158: 
1.5       misho     159: /*
1.7       misho     160:  * str_getString() - Get NULL delimited string from data buffer
1.5       misho     161:  *
1.7       misho     162:  * @data = Const data buffer
1.5       misho     163:  * @dlen = Data length
                    164:  * @next = Return next position after string if !=NULL
                    165:  * return: -1 error or size of string 
                    166:  */
                    167: int str_getString(const unsigned char * __restrict data, int dlen, 
1.7       misho     168:                char ** __restrict next);
                    169: /*
                    170:  * str_getString2() - Get string from data buffer with delimiter
                    171:  *
                    172:  * @data = Data buffer
                    173:  * @dlen = Data length
                    174:  * @delim = Data delimiter
                    175:  * @next = Return next position after delimited string if !=NULL
                    176:  * return: -1 error or size of string 
                    177:  */
                    178: int str_getString2(char * __restrict data, int dlen, char delim, 
1.5       misho     179:                char ** __restrict next);
                    180: 
1.1       misho     181: 
                    182: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>