diff options
| author | 2009-01-29 19:26:15 +0100 | |
|---|---|---|
| committer | 2009-01-29 19:26:15 +0100 | |
| commit | 296a38509d12306e423800ed2c583a94a31eddff (patch) | |
| tree | eab14f9e63eb03dc89607a7d4c1aa2ef00046a0f /src/utils.c | |
| parent | 8c2751f8c7e696fca895aebfafc7e668f3afe85c (diff) | |
| download | libplist-296a38509d12306e423800ed2c583a94a31eddff.tar.gz libplist-296a38509d12306e423800ed2c583a94a31eddff.tar.bz2 | |
Clean some old stuff.
Diffstat (limited to 'src/utils.c')
| -rw-r--r-- | src/utils.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/src/utils.c b/src/utils.c deleted file mode 100644 index 920b347..0000000 --- a/src/utils.c +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * utils.c | ||
| 3 | * contains utilitary methos for logging and debugging | ||
| 4 | * | ||
| 5 | * Copyright (c) 2008 Jonathan Beck All Rights Reserved. | ||
| 6 | * | ||
| 7 | * This library is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU Lesser General Public | ||
| 9 | * License as published by the Free Software Foundation; either | ||
| 10 | * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This library is distributed in the hope that it will be useful, | ||
| 13 | * but 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 library; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | #include <stdarg.h> | ||
| 22 | #include <stdio.h> | ||
| 23 | #include "utils.h" | ||
| 24 | |||
| 25 | int toto_debug = 0; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * Sets the level of debugging. Currently the only acceptable values are 0 and | ||
| 29 | * 1. | ||
| 30 | * | ||
| 31 | * @param level Set to 0 for no debugging or 1 for debugging. | ||
| 32 | */ | ||
| 33 | void iphone_set_debug(int level) | ||
| 34 | { | ||
| 35 | toto_debug = level; | ||
| 36 | } | ||
| 37 | |||
| 38 | void log_debug_msg(const char *format, ...) | ||
| 39 | { | ||
| 40 | #ifndef STRIP_DEBUG_CODE | ||
| 41 | |||
| 42 | va_list args; | ||
| 43 | /* run the real fprintf */ | ||
| 44 | va_start(args, format); | ||
| 45 | |||
| 46 | if (toto_debug) | ||
| 47 | vfprintf(stderr, format, args); | ||
| 48 | |||
| 49 | va_end(args); | ||
| 50 | |||
| 51 | #endif | ||
| 52 | } | ||
| 53 | |||
| 54 | inline void log_debug_buffer(const char *data, const int length) | ||
| 55 | { | ||
| 56 | #ifndef STRIP_DEBUG_CODE | ||
| 57 | |||
| 58 | /* run the real fprintf */ | ||
| 59 | if (toto_debug) | ||
| 60 | fwrite(data, 1, length, stderr); | ||
| 61 | #endif | ||
| 62 | } | ||
| 63 | |||
| 64 | inline void dump_debug_buffer(const char *file, const char *data, const int length) | ||
| 65 | { | ||
| 66 | #ifndef STRIP_DEBUG_CODE | ||
| 67 | |||
| 68 | /* run the real fprintf */ | ||
| 69 | if (toto_debug) { | ||
| 70 | FILE *my_ssl_packet = fopen(file, "w+"); | ||
| 71 | fwrite(data, 1, length, my_ssl_packet); | ||
| 72 | fflush(my_ssl_packet); | ||
| 73 | fprintf(stderr, "Wrote SSL packet to drive, too.\n"); | ||
| 74 | fclose(my_ssl_packet); | ||
| 75 | } | ||
| 76 | #endif | ||
| 77 | } | ||
