]> git.cryptolib.org Git - arm-crypto-lib.git/blob - test_src/dbz_strings.c
bigint looks good but needs more testing
[arm-crypto-lib.git] / test_src / dbz_strings.c
1 /* dbz_strings.c */
2 /*
3  *   This file is part of AnonAccess, an access system which can be used
4  *    to open door or doing other things with an anonymity featured
5  *    account managment.
6  *   Copyright (C) 2006-2010  Daniel Otte (daniel.otte@rub.de)
7  *
8  *   This program is free software: you can redistribute it and/or modify
9  *   it under the terms of the GNU General Public License as published by
10  *   the Free Software Foundation, either version 3 of the License, or
11  *   (at your option) any later version.
12  *
13  *   This program is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22
23 /*
24  * author: Daniel Otte
25  * email:  daniel.otte@rub.de
26  * license: GPLv3
27  * 
28  * */
29
30 #include <stdint.h>
31 #include <string.h>
32  
33 /******************************************************************************/
34
35 uint8_t dbz_strcount(const char* str){
36         uint8_t ret=1;
37         if(*str=='\0' && *(str+1)=='\0')
38                         return 0;
39         for(;;){
40                 while(*str++)
41                         ;
42                 if(*str=='\0')
43                         return ret;
44                 ++ret;
45         }       
46 }
47
48 /******************************************************************************/
49
50 void dbz_splitup(char* dbzstr, char** strings){
51         if(*dbzstr=='\0' && *(dbzstr+1)=='\0')
52                 return;
53         *strings++ = dbzstr;
54         for(;;){        
55                 while(*dbzstr++)
56                         ;
57                 if(*dbzstr=='\0')
58                         return;
59                 *strings++ = dbzstr;
60         }
61 }
62
63 /******************************************************************************/
64