pam_pkcs11 0.6.12
strings.h
Go to the documentation of this file.
1/*
2 * PAM-PKCS11 string tools
3 * Copyright (C) 2005 Juan Antonio Martinez <jonsito@teleline.es>
4 * pam-pkcs11 is copyright (C) 2003-2004 of Mario Strasser <mast@gmx.net>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * $Id$
21 */
22
23#ifndef __STRINGS_H_
24#define __STRINGS_H_
25
26#ifdef HAVE_CONFIG_H
27#include <config.h>
28#endif
29
30#include <stdlib.h>
31#include <string.h>
32
36#ifndef _STRINGS_C_
37#define M_EXTERN extern
38#else
39#define M_EXTERN
40#endif
41
47M_EXTERN int is_empty_str(const char *str);
48
54M_EXTERN char *clone_str(const char *str);
55
61M_EXTERN char *toupper_str(const char *str);
62
68M_EXTERN char *tolower_str(const char *str);
69
76M_EXTERN char *bin2hex(const unsigned char *binstr,const int len);
77
83M_EXTERN unsigned char *hex2bin(const char *hexstr);
84
93M_EXTERN unsigned char *hex2bin_static(const char *hexstr,unsigned char **res,int *size);
94
104M_EXTERN char **split(const char *str,char sep, int nelems);
105
117M_EXTERN char **split_static(const char *str,char sep, int nelems,char *dst);
118
126M_EXTERN char *trim(const char *str);
127
128#undef M_EXTERN
129
130#endif
M_EXTERN char * tolower_str(const char *str)
Duplicate a string converting all chars to lower-case.
M_EXTERN unsigned char * hex2bin_static(const char *hexstr, unsigned char **res, int *size)
Convert a colon-separated hexadecimal data into a byte array, store result into a previously allocate...
M_EXTERN char * clone_str(const char *str)
Duplicate a string.
M_EXTERN char ** split_static(const char *str, char sep, int nelems, char *dst)
Splits a string to an array of nelems by using sep as character separator, using dest as pre-allocate...
M_EXTERN int is_empty_str(const char *str)
Check for a null or spaced string.
M_EXTERN char * bin2hex(const unsigned char *binstr, const int len)
Convert a byte array into a colon-separated hexadecimal sequence.
M_EXTERN unsigned char * hex2bin(const char *hexstr)
Convert a colon-separated hexadecimal data into a byte array.
M_EXTERN char ** split(const char *str, char sep, int nelems)
Splits a string to an array of nelems by using sep as character separator.
M_EXTERN char * toupper_str(const char *str)
Duplicate a string converting all chars to upper-case.
M_EXTERN char * trim(const char *str)
Remove all extra spaces from a string.
#define M_EXTERN
String management library.
Definition strings.h:37