X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=string-extras.h;h=857602098099d1bbcd13bf94244675b50440101d;hp=457f9a7123d2e0dc7573d10bb3e60c3e1bd0d0e7;hb=deca11a7e7be5605c387aa2cd577e22925854ff8;hpb=a3e1c2903dd75b77176dd7a1b13e5a87ef04e7f5 diff --git a/string-extras.h b/string-extras.h index 457f9a7..8576020 100644 --- a/string-extras.h +++ b/string-extras.h @@ -1,4 +1,4 @@ -/* string_extras.h */ +/* string-extras.h */ /* This file is part of the AVR-Crypto-Lib. Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) @@ -17,13 +17,39 @@ along with this program. If not, see . */ /** - * \file string_extras.h + * \file string-extras.h * \author Daniel Otte * \date 2006-05-16 * \license GPLv3 or later * */ -uint16_t stridentcnt_P(char* a, PGM_P b); -uint16_t firstword_length(char* s); -char* strstrip(char*); +/** \fn stridentcnt_P(char *a, PGM_P b) + * \brief counts the number of identic chars + * + * This function compares the supplyed strings and returns the index of the + * first char where the strings differ. + * \param a pointer to string in RAM + * \param b pointer to string in Flash + * \return index of the first char where \c a and \c b differ + */ +uint16_t stridentcnt_P(char *a, PGM_P b); + +/** \fn firstword_length(char *s) + * \brief compute the length of the first word in supllyed string + * + * This function searches for the first whitespace in the string and returns the + * number of chars before the first whitespace. + * \param s string + * \return number of chars in first word + */ +uint16_t firstword_length(char *s); + +/** \fn strstrip(char *str) + * \brief removes whitespace at the beginning and the end of a string + * + * This function removes whitespaces at the end of a string. + * \param str sting + * \return pointer to the first non-whitespace char in string + */ +char *strstrip(char *str);