~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to jnlib/stringhelp.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* stringhelp.h
2
 
 * Copyright (C) 1998,1999,2000,2001,2003 Free Software Foundation, Inc.
3
 
 *
4
 
 * This file is part of GnuPG.
5
 
 *
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.
10
 
 *
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.
15
 
 *
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.
 
4
 *
 
5
 * This file is part of JNLIB.
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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/>.
19
19
 */
20
20
 
21
21
#ifndef LIBJNLIB_STRINGHELP_H
35
35
size_t length_sans_trailing_ws (const unsigned char *line, size_t len);
36
36
 
37
37
 
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 );
42
42
 
 
43
int hextobyte (const char *s);
 
44
 
43
45
size_t print_sanitized_buffer (FILE *fp, const void *buffer, size_t length,
44
46
                               int delim);
 
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);
50
56
 
51
57
 
 
58
size_t utf8_charcount (const char *s);
 
59
 
 
60
 
52
61
#ifdef HAVE_W32_SYSTEM
53
62
const char *w32_strerror (int ec);
54
63
#endif
72
81
#ifndef HAVE_STPCPY
73
82
char *stpcpy(char *a,const char *b);
74
83
#endif
 
84
#ifndef HAVE_STRSEP
 
85
char *strsep (char **stringp, const char *delim);
 
86
#endif
75
87
#ifndef HAVE_STRLWR
76
88
char *strlwr(char *a);
77
89
#endif
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)))
80
92
#endif
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))
83
95
#endif
84
96
#ifndef HAVE_STRICMP
85
 
  #define stricmp(a,b)   strcasecmp( (a), (b) )
86
 
#endif
 
97
#  define stricmp(a,b)   strcasecmp( (a), (b) )
 
98
#endif
 
99
#ifndef HAVE_MEMRCHR
 
100
void *memrchr (const void *buffer, int c, size_t n);
 
101
#endif
 
102
 
 
103
 
 
104
#ifndef HAVE_ISASCII
 
105
static inline int 
 
106
isascii (int c)
 
107
{
 
108
  return (((c) & ~0x7f) == 0);
 
109
}
 
110
#endif /* !HAVE_ISASCII */
 
111
 
87
112
 
88
113
#ifndef STR
89
 
  #define STR(v) #v
 
114
#  define STR(v) #v
90
115
#endif
91
116
#define STR2(v) STR(v)
92
117
 
 
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
 
121
   allocated.  */
 
122
char *percent_escape (const char *str, const char *extra);
 
123
char *try_percent_escape (const char *str, const char *extra);
 
124
 
93
125
 
94
126
#endif /*LIBJNLIB_STRINGHELP_H*/