Adam Tkac | 247b729 | 2008-11-14 13:11:31 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2008 TightVNC Team. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef OS_PRINT_H |
| 20 | #define OS_PRINT_H |
| 21 | |
Adam Tkac | 8aee1a8 | 2009-09-04 12:08:56 +0000 | [diff] [blame] | 22 | #ifdef HAVE_CONFIG_H |
| 23 | #include <config.h> |
Adam Tkac | 247b729 | 2008-11-14 13:11:31 +0000 | [diff] [blame] | 24 | #endif |
| 25 | |
| 26 | #include <stdarg.h> |
Adam Tkac | 20e0d71 | 2008-11-14 14:48:21 +0000 | [diff] [blame] | 27 | #include <stdio.h> |
Adam Tkac | 247b729 | 2008-11-14 13:11:31 +0000 | [diff] [blame] | 28 | #include <sys/types.h> |
| 29 | |
Adam Tkac | 20e0d71 | 2008-11-14 14:48:21 +0000 | [diff] [blame] | 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
Adam Tkac | 247b729 | 2008-11-14 13:11:31 +0000 | [diff] [blame] | 34 | #ifndef HAVE_VSNPRINTF |
Adam Tkac | 241e900 | 2008-12-03 14:13:36 +0000 | [diff] [blame] | 35 | /* NOTE: |
| 36 | * |
| 37 | * This is only very limited implementation for our internal purposes. It |
| 38 | * doesn't conform to C99/POSIX |
| 39 | * - limited conversion specifiers |
| 40 | * - returns written number of characters instead of number what would be |
| 41 | * written |
| 42 | */ |
| 43 | int tight_vsnprintf(char *str, size_t n, const char *format, va_list ap); |
| 44 | #define vsnprintf tight_vsnprintf |
Adam Tkac | 247b729 | 2008-11-14 13:11:31 +0000 | [diff] [blame] | 45 | #endif |
| 46 | |
Adam Tkac | 3422fbd | 2008-12-03 14:18:19 +0000 | [diff] [blame] | 47 | #ifndef HAVE_SNPRINTF |
| 48 | /* Inherits tight_vsnprintf limitations if vsnprintf is not present */ |
| 49 | int tight_snprintf(char *str, size_t n, const char *format, ...); |
| 50 | #define snprintf tight_snprintf |
| 51 | #endif |
| 52 | |
Adam Tkac | 20e0d71 | 2008-11-14 14:48:21 +0000 | [diff] [blame] | 53 | #ifdef __cplusplus |
| 54 | }; |
| 55 | #endif |
| 56 | |
Adam Tkac | 247b729 | 2008-11-14 13:11:31 +0000 | [diff] [blame] | 57 | #endif /* OS_PRINT_H */ |