File:
[ELWIX - Embedded LightWeight unIX -] /
libelwix /
inc /
elwix /
astr.h
Revision
1.8:
download - view:
text,
annotated -
select for diffs -
revision graph
Wed Jan 23 13:26:28 2019 UTC (5 years, 5 months ago) by
misho
Branches:
MAIN
CVS tags:
elwix5_9,
elwix5_8,
elwix5_7,
elwix5_6,
elwix5_5,
elwix5_4,
elwix5_3,
elwix5_2,
elwix5_12,
elwix5_11,
elwix5_10,
elwix5_1,
elwix5_0,
elwix4_26,
elwix4_25,
elwix4_24,
elwix4_23,
elwix4_22,
elwix4_21,
elwix4_20,
HEAD,
ELWIX5_9,
ELWIX5_8,
ELWIX5_7,
ELWIX5_6,
ELWIX5_5,
ELWIX5_4,
ELWIX5_3,
ELWIX5_2,
ELWIX5_11,
ELWIX5_10,
ELWIX5_1,
ELWIX5_0,
ELWIX4_26,
ELWIX4_25,
ELWIX4_24,
ELWIX4_23,
ELWIX4_22,
ELWIX4_21,
ELWIX4_20,
ELWIX4_19
ver 4.19
1: /*************************************************************************
2: * (C) 2013 AITNET ltd - Sofia/Bulgaria - <misho@aitnet.org>
3: * by Michael Pounov <misho@elwix.org>
4: *
5: * $Author: misho $
6: * $Id: astr.h,v 1.8 2019/01/23 13:26:28 misho Exp $
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:
15: Copyright 2004 - 2019
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: */
56: void str_FreeNullTerm(char *** __restrict arr);
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: */
64: int str_ArgsNum(const char *csArgs, const char *csDelim);
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: */
96: int str_LTrim(char * __restrict psLine);
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: */
103: int str_RTrim(char * __restrict psLine);
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: */
110: int str_Trim(char * __restrict psLine);
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: */
117: int str_Unquot(char * __restrict psLine);
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: */
124: int str_Upper(char * __restrict psLine);
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: */
131: int str_Lower(char * __restrict psLine);
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);
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);
158:
159: /*
160: * str_getString() - Get NULL delimited string from data buffer
161: *
162: * @data = Const data buffer
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,
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,
179: char ** __restrict next);
180:
181:
182: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>