]> git.saurik.com Git - apt.git/blame_incremental - test/interactive-helper/libnoprofile.c
Don't download "optional" files not in Release :/.
[apt.git] / test / interactive-helper / libnoprofile.c
... / ...
CommitLineData
1#define _GNU_SOURCE
2#include <stdarg.h>
3#include <stdlib.h>
4#include <string.h>
5#include <dlfcn.h>
6#include <unistd.h>
7#include <stdio.h>
8
9int vprintf(const char *format, va_list ap) {
10 static int (*func_fprintf)(const char *format, va_list ap) = NULL;
11 if (func_fprintf == NULL)
12 func_fprintf = (int (*) (const char *format, va_list ap)) dlsym(RTLD_NEXT, "vprintf");
13
14 va_list ap2;
15 va_copy(ap2, ap);
16 if (strncmp(format, "profiling:", strlen("profiling:")) == 0)
17 return 0;
18 int res = func_fprintf(format, ap2);
19 va_end(ap2);
20 return res;
21}
22int printf(const char *format, ...) {
23 va_list ap;
24 va_start(ap, format);
25 int res = vprintf(format, ap);
26 va_end(ap);
27 return res;
28}
29
30int vfprintf(FILE *stream, const char *format, va_list ap) {
31 static int (*func_vfprintf)(FILE *stream, const char *format, va_list ap) = NULL;
32 if (func_vfprintf == NULL)
33 func_vfprintf = (int (*) (FILE *stream, const char *format, va_list ap)) dlsym(RTLD_NEXT, "vfprintf");
34
35 va_list ap2;
36 va_copy(ap2, ap);
37 if (strncmp(format, "profiling:", strlen("profiling:")) == 0)
38 return 0;
39 int res = func_vfprintf(stream, format, ap2);
40 va_end(ap2);
41 return res;
42}
43
44int fprintf(FILE *stream, const char *format, ...) {
45 va_list ap;
46 va_start(ap, format);
47 int res = vfprintf(stream, format, ap);
48 va_end(ap);
49 return res;
50}