1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
|
/* visibility.c - Wrapper for all public functions.
* Copyright (C) 2014 g10 Code GmbH
*
* This file is part of libgpg-error.
*
* libgpg-error is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* libgpg-error is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdarg.h>
#define _GPGRT_INCL_BY_VISIBILITY_C 1
#include "gpgrt-int.h"
const char *
gpg_strerror (gpg_error_t err)
{
return _gpg_strerror (err);
}
int
gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen)
{
return _gpg_strerror_r (err, buf, buflen);
}
const char *
gpg_strsource (gpg_error_t err)
{
return _gpg_strsource (err);
}
gpg_err_code_t
gpg_err_code_from_errno (int err)
{
return _gpg_err_code_from_errno (err);
}
int
gpg_err_code_to_errno (gpg_err_code_t code)
{
return _gpg_err_code_to_errno (code);
}
gpg_err_code_t
gpg_err_code_from_syserror (void)
{
return _gpg_err_code_from_syserror ();
}
void
gpg_err_set_errno (int err)
{
_gpg_err_set_errno (err);
}
gpg_error_t
gpg_err_init (void)
{
return _gpg_err_init ();
}
void
gpg_err_deinit (int mode)
{
_gpg_err_deinit (mode);
}
const char *
gpg_error_check_version (const char *req_version)
{
return _gpg_error_check_version (req_version);
}
const char *
gpgrt_check_version (const char *req_version)
{
return _gpg_error_check_version (req_version);
}
void
gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void))
{
_gpgrt_set_syscall_clamp (pre, post);
}
void
gpgrt_set_alloc_func (void *(*f)(void *a, size_t n))
{
_gpgrt_set_alloc_func (f);
}
gpg_err_code_t
gpgrt_lock_init (gpgrt_lock_t *lockhd)
{
return _gpgrt_lock_init (lockhd);
}
gpg_err_code_t
gpgrt_lock_lock (gpgrt_lock_t *lockhd)
{
return _gpgrt_lock_lock (lockhd);
}
gpg_err_code_t
gpgrt_lock_trylock (gpgrt_lock_t *lockhd)
{
return _gpgrt_lock_trylock (lockhd);
}
gpg_err_code_t
gpgrt_lock_unlock (gpgrt_lock_t *lockhd)
{
return _gpgrt_lock_unlock (lockhd);
}
gpg_err_code_t
gpgrt_lock_destroy (gpgrt_lock_t *lockhd)
{
return _gpgrt_lock_destroy (lockhd);
}
gpg_err_code_t
gpgrt_yield (void)
{
return _gpgrt_yield ();
}
estream_t
gpgrt_fopen (const char *_GPGRT__RESTRICT path,
const char *_GPGRT__RESTRICT mode)
{
return _gpgrt_fopen (path, mode);
}
estream_t
gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len,
unsigned int grow,
void *(*func_realloc) (void *mem, size_t size),
void (*func_free) (void *mem),
const char *_GPGRT__RESTRICT mode)
{
return _gpgrt_mopen (data, data_n, data_len, grow, func_realloc, func_free,
mode);
}
estream_t
gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode)
{
return _gpgrt_fopenmem (memlimit, mode);
}
estream_t
gpgrt_fopenmem_init (size_t memlimit, const char *_GPGRT__RESTRICT mode,
const void *data, size_t datalen)
{
return _gpgrt_fopenmem_init (memlimit, mode, data, datalen);
}
estream_t
gpgrt_fdopen (int filedes, const char *mode)
{
return _gpgrt_fdopen (filedes, mode);
}
estream_t
gpgrt_fdopen_nc (int filedes, const char *mode)
{
return _gpgrt_fdopen_nc (filedes, mode);
}
estream_t
gpgrt_sysopen (es_syshd_t *syshd, const char *mode)
{
return _gpgrt_sysopen (syshd, mode);
}
estream_t
gpgrt_sysopen_nc (es_syshd_t *syshd, const char *mode)
{
return _gpgrt_sysopen_nc (syshd, mode);
}
estream_t
gpgrt_fpopen (FILE *fp, const char *mode)
{
return _gpgrt_fpopen (fp, mode);
}
estream_t
gpgrt_fpopen_nc (FILE *fp, const char *mode)
{
return _gpgrt_fpopen_nc (fp, mode);
}
estream_t
gpgrt_freopen (const char *_GPGRT__RESTRICT path,
const char *_GPGRT__RESTRICT mode,
estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_freopen (path, mode, stream);
}
estream_t
gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie,
const char *_GPGRT__RESTRICT mode,
gpgrt_cookie_io_functions_t functions)
{
return _gpgrt_fopencookie (cookie, mode, functions);
}
int
gpgrt_fclose (estream_t stream)
{
return _gpgrt_fclose (stream);
}
int
gpgrt_fclose_snatch (estream_t stream, void **r_buffer, size_t *r_buflen)
{
return _gpgrt_fclose_snatch (stream, r_buffer, r_buflen);
}
int
gpgrt_onclose (estream_t stream, int mode,
void (*fnc) (estream_t, void*), void *fnc_value)
{
return _gpgrt_onclose (stream, mode, fnc, fnc_value);
}
int
gpgrt_fileno (estream_t stream)
{
return _gpgrt_fileno (stream);
}
int
gpgrt_fileno_unlocked (estream_t stream)
{
return _gpgrt_fileno_unlocked (stream);
}
int
gpgrt_syshd (estream_t stream, es_syshd_t *syshd)
{
return _gpgrt_syshd (stream, syshd);
}
int
gpgrt_syshd_unlocked (estream_t stream, es_syshd_t *syshd)
{
return _gpgrt_syshd_unlocked (stream, syshd);
}
void
_gpgrt_set_std_fd (int no, int fd)
{
_gpgrt__set_std_fd (no, fd); /* (double dash in name) */
}
estream_t
_gpgrt_get_std_stream (int fd)
{
return _gpgrt__get_std_stream (fd); /* (double dash in name) */
}
void
gpgrt_flockfile (estream_t stream)
{
_gpgrt_flockfile (stream);
}
int
gpgrt_ftrylockfile (estream_t stream)
{
return _gpgrt_ftrylockfile (stream);
}
void
gpgrt_funlockfile (estream_t stream)
{
_gpgrt_funlockfile (stream);
}
int
_gpgrt_pending (estream_t stream)
{
return _gpgrt__pending (stream);
}
int
_gpgrt_pending_unlocked (estream_t stream)
{
return _gpgrt__pending_unlocked (stream);
}
int
gpgrt_feof (estream_t stream)
{
return _gpgrt_feof (stream);
}
int
gpgrt_feof_unlocked (estream_t stream)
{
return _gpgrt_feof_unlocked (stream);
}
int
gpgrt_ferror (estream_t stream)
{
return _gpgrt_ferror (stream);
}
int
gpgrt_ferror_unlocked (estream_t stream)
{
return _gpgrt_ferror_unlocked (stream);
}
void
gpgrt_clearerr (estream_t stream)
{
_gpgrt_clearerr (stream);
}
void
gpgrt_clearerr_unlocked (estream_t stream)
{
_gpgrt_clearerr_unlocked (stream);
}
int
gpgrt_fflush (estream_t stream)
{
return _gpgrt_fflush (stream);
}
int
gpgrt_fseek (estream_t stream, long int offset, int whence)
{
return _gpgrt_fseek (stream, offset, whence);
}
int
gpgrt_fseeko (estream_t stream, gpgrt_off_t offset, int whence)
{
return _gpgrt_fseeko (stream, offset, whence);
}
long int
gpgrt_ftell (estream_t stream)
{
return _gpgrt_ftell (stream);
}
gpgrt_off_t
gpgrt_ftello (estream_t stream)
{
return _gpgrt_ftello (stream);
}
void
gpgrt_rewind (estream_t stream)
{
_gpgrt_rewind (stream);
}
int
gpgrt_fgetc (estream_t stream)
{
return _gpgrt_fgetc (stream);
}
int
_gpgrt_getc_underflow (estream_t stream)
{
return _gpgrt__getc_underflow (stream);
}
int
gpgrt_fputc (int c, estream_t stream)
{
return _gpgrt_fputc (c, stream);
}
int
_gpgrt_putc_overflow (int c, estream_t stream)
{
return _gpgrt__putc_overflow (c, stream);
}
int
gpgrt_ungetc (int c, estream_t stream)
{
return _gpgrt_ungetc (c, stream);
}
int
gpgrt_read (estream_t _GPGRT__RESTRICT stream,
void *_GPGRT__RESTRICT buffer, size_t bytes_to_read,
size_t *_GPGRT__RESTRICT bytes_read)
{
return _gpgrt_read (stream, buffer, bytes_to_read, bytes_read);
}
int
gpgrt_write (estream_t _GPGRT__RESTRICT stream,
const void *_GPGRT__RESTRICT buffer, size_t bytes_to_write,
size_t *_GPGRT__RESTRICT bytes_written)
{
return _gpgrt_write (stream, buffer, bytes_to_write, bytes_written);
}
int
gpgrt_write_sanitized (estream_t _GPGRT__RESTRICT stream,
const void * _GPGRT__RESTRICT buffer, size_t length,
const char * delimiters,
size_t * _GPGRT__RESTRICT bytes_written)
{
return _gpgrt_write_sanitized (stream, buffer, length, delimiters,
bytes_written);
}
int
gpgrt_write_hexstring (estream_t _GPGRT__RESTRICT stream,
const void *_GPGRT__RESTRICT buffer, size_t length,
int reserved, size_t *_GPGRT__RESTRICT bytes_written )
{
return _gpgrt_write_hexstring (stream, buffer, length, reserved,
bytes_written);
}
size_t
gpgrt_fread (void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems,
estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_fread (ptr, size, nitems, stream);
}
size_t
gpgrt_fwrite (const void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems,
estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_fwrite (ptr, size, nitems, stream);
}
char *
gpgrt_fgets (char *_GPGRT__RESTRICT buffer, int length,
estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_fgets (buffer, length, stream);
}
int
gpgrt_fputs (const char *_GPGRT__RESTRICT s, estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_fputs (s, stream);
}
int
gpgrt_fputs_unlocked (const char *_GPGRT__RESTRICT s,
estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_fputs_unlocked (s, stream);
}
gpgrt_ssize_t
gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr,
size_t *_GPGRT__RESTRICT n, estream_t _GPGRT__RESTRICT stream)
{
return _gpgrt_getline (lineptr, n, stream);
}
gpgrt_ssize_t
gpgrt_read_line (estream_t stream,
char **addr_of_buffer, size_t *length_of_buffer,
size_t *max_length)
{
return _gpgrt_read_line (stream, addr_of_buffer, length_of_buffer,
max_length);
}
void
gpgrt_free (void *a)
{
if (a)
_gpgrt_free (a);
}
int
gpgrt_vfprintf (estream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format,
va_list ap)
{
return _gpgrt_vfprintf (stream, format, ap);
}
int
gpgrt_vfprintf_unlocked (estream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format,
va_list ap)
{
return _gpgrt_vfprintf_unlocked (stream, format, ap);
}
int
gpgrt_printf (const char *_GPGRT__RESTRICT format, ...)
{
va_list ap;
int rc;
va_start (ap, format);
rc = _gpgrt_vfprintf (es_stdout, format, ap);
va_end (ap);
return rc;
}
int
gpgrt_printf_unlocked (const char *_GPGRT__RESTRICT format, ...)
{
va_list ap;
int rc;
va_start (ap, format);
rc = _gpgrt_vfprintf_unlocked (es_stdout, format, ap);
va_end (ap);
return rc;
}
int
gpgrt_fprintf (estream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format, ...)
{
va_list ap;
int rc;
va_start (ap, format);
rc = _gpgrt_vfprintf (stream, format, ap);
va_end (ap);
return rc;
}
int
gpgrt_fprintf_unlocked (estream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format, ...)
{
va_list ap;
int rc;
va_start (ap, format);
rc = _gpgrt_vfprintf_unlocked (stream, format, ap);
va_end (ap);
return rc;
}
int
gpgrt_setvbuf (estream_t _GPGRT__RESTRICT stream,
char *_GPGRT__RESTRICT buf, int type, size_t size)
{
return _gpgrt_setvbuf (stream, buf, type, size);
}
void
gpgrt_setbuf (estream_t _GPGRT__RESTRICT stream, char *_GPGRT__RESTRICT buf)
{
_gpgrt_setvbuf (stream, buf, buf? _IOFBF : _IONBF, BUFSIZ);
}
void
gpgrt_set_binary (estream_t stream)
{
_gpgrt_set_binary (stream);
}
estream_t
gpgrt_tmpfile (void)
{
return _gpgrt_tmpfile ();
}
void
gpgrt_opaque_set (estream_t stream, void *opaque)
{
_gpgrt_opaque_set (stream, opaque);
}
void *
gpgrt_opaque_get (estream_t stream)
{
return _gpgrt_opaque_get (stream);
}
void
gpgrt_fname_set (estream_t stream, const char *fname)
{
_gpgrt_fname_set (stream, fname);
}
const char *
gpgrt_fname_get (estream_t stream)
{
return _gpgrt_fname_get (stream);
}
int
gpgrt_asprintf (char **r_buf, const char *_GPGRT__RESTRICT format, ...)
{
va_list ap;
int rc;
va_start (ap, format);
rc = _gpgrt_estream_vasprintf (r_buf, format, ap);
va_end (ap);
return rc;
}
int
gpgrt_vasprintf (char **r_buf, const char *_GPGRT__RESTRICT format, va_list ap)
{
return _gpgrt_estream_vasprintf (r_buf, format, ap);
}
char *
gpgrt_bsprintf (const char *_GPGRT__RESTRICT format, ...)
{
int rc;
va_list ap;
char *buf;
va_start (ap, format);
rc = _gpgrt_estream_vasprintf (&buf, format, ap);
va_end (ap);
if (rc < 0)
return NULL;
return buf;
}
char *
gpgrt_vbsprintf (const char *_GPGRT__RESTRICT format, va_list ap)
{
int rc;
char *buf;
rc = _gpgrt_estream_vasprintf (&buf, format, ap);
if (rc < 0)
return NULL;
return buf;
}
int
gpgrt_snprintf (char *buf, size_t bufsize, const char *format, ...)
{
int rc;
va_list arg_ptr;
va_start (arg_ptr, format);
rc = _gpgrt_estream_vsnprintf (buf, bufsize, format, arg_ptr);
va_end (arg_ptr);
return rc;
}
int
gpgrt_vsnprintf (char *buf, size_t bufsize,
const char *format, va_list arg_ptr)
{
return _gpgrt_estream_vsnprintf (buf, bufsize, format, arg_ptr);
}
|