]> git.cryptolib.org Git - avr-crypto-lib.git/blob - string-extras.h
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / string-extras.h
1 /* string-extras.h */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 /**
20  * \file        string-extras.h
21  * \author  Daniel Otte 
22  * \date    2006-05-16
23  * \license     GPLv3 or later
24  * 
25  */
26
27 /** \fn stridentcnt_P(char *a, PGM_P b)
28  * \brief counts the number of identic chars
29  * 
30  * This function compares the supplyed strings and returns the index of the 
31  * first char where the strings differ.
32  * \param a pointer to string in RAM
33  * \param b pointer to string in Flash
34  * \return index of the first char where \c a and \c b differ
35  */
36 uint16_t stridentcnt_P(char *a, PGM_P b);
37
38 /** \fn firstword_length(char *s)
39  * \brief compute the length of the first word in supllyed string
40  * 
41  * This function searches for the first whitespace in the string and returns the
42  * number of chars before the first whitespace.
43  * \param s string
44  * \return number of chars in first word
45  */
46 uint16_t firstword_length(char *s);
47
48 /** \fn strstrip(char *str)
49  * \brief removes whitespace at the beginning and the end of a string
50  * 
51  * This function removes whitespaces at the end of a string.
52  * \param str sting
53  * \return pointer to the first non-whitespace char in string
54  */
55 char *strstrip(char *str);