2
* Copyright (C) 1998,1999,2000,2001,2003 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG 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 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG 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.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
2
* Copyright (C) 1998, 1999, 2000, 2001, 2003,
3
* 2006, 2007 Free Software Foundation, Inc.
5
* This file is part of JNLIB.
7
* JNLIB is free software; you can redistribute it and/or modify it
8
* under the terms of the GNU Lesser General Public License as
9
* published by the Free Software Foundation; either version 3 of
10
* the License, or (at your option) any later version.
12
* JNLIB is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
21
21
#ifndef LIBJNLIB_STRINGHELP_H
35
35
size_t length_sans_trailing_ws (const unsigned char *line, size_t len);
38
char *make_basename(const char *filepath);
38
char *make_basename(const char *filepath, const char *inputpath);
39
39
char *make_dirname(const char *filepath);
40
40
char *make_filename( const char *first_part, ... );
41
41
int compare_filenames( const char *a, const char *b );
43
int hextobyte (const char *s);
43
45
size_t print_sanitized_buffer (FILE *fp, const void *buffer, size_t length,
47
size_t print_sanitized_buffer2 (FILE *fp, const void *buffer, size_t length,
48
int delim, int delim2);
45
49
size_t print_sanitized_utf8_buffer (FILE *fp, const void *buffer,
46
50
size_t length, int delim);
47
51
size_t print_sanitized_string (FILE *fp, const char *string, int delim);
52
size_t print_sanitized_string2 (FILE *fp, const char *string,
53
int delim, int delim2);
48
54
size_t print_sanitized_utf8_string (FILE *fp, const char *string, int delim);
49
55
char *sanitize_buffer (const void *p, size_t n, int delim);
58
size_t utf8_charcount (const char *s);
52
61
#ifdef HAVE_W32_SYSTEM
53
62
const char *w32_strerror (int ec);
72
81
#ifndef HAVE_STPCPY
73
82
char *stpcpy(char *a,const char *b);
85
char *strsep (char **stringp, const char *delim);
75
87
#ifndef HAVE_STRLWR
76
88
char *strlwr(char *a);
78
90
#ifndef HAVE_STRTOUL
79
#define strtoul(a,b,c) ((unsigned long)strtol((a),(b),(c)))
91
# define strtoul(a,b,c) ((unsigned long)strtol((a),(b),(c)))
81
93
#ifndef HAVE_MEMMOVE
82
#define memmove(d, s, n) bcopy((s), (d), (n))
94
# define memmove(d, s, n) bcopy((s), (d), (n))
84
96
#ifndef HAVE_STRICMP
85
#define stricmp(a,b) strcasecmp( (a), (b) )
97
# define stricmp(a,b) strcasecmp( (a), (b) )
100
void *memrchr (const void *buffer, int c, size_t n);
108
return (((c) & ~0x7f) == 0);
110
#endif /* !HAVE_ISASCII */
91
116
#define STR2(v) STR(v)
118
/* Percent-escape the string STR by replacing colons with '%3a'. If
119
EXTRA is not NULL, also replace all characters given in EXTRA. The
120
"try_" variant fails with NULL if not enough memory can be
122
char *percent_escape (const char *str, const char *extra);
123
char *try_percent_escape (const char *str, const char *extra);
94
126
#endif /*LIBJNLIB_STRINGHELP_H*/