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.2.4.1 2013/05/26 20:03:19 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, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
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:
151: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>