2 libc-extension.hh -- declare some string.h extensions
4 source file of the flowerlib
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #ifndef LIBC_EXTENSION_HH
10 #define LIBC_EXTENSION_HH
17 char *strnlwr (char *start, int n);
18 char *strnupr (char *start, int n);
20 #if ! HAVE_MEMMEM /* GNU extension. */
21 void *memmem (void const* haystack, int haystack_len,
22 void const *needle, int needle_len);
23 #endif /* HAVE_MEMMEM */
25 #if ! HAVE_SNPRINTF /* GNU extension. */
26 int snprintf (char *str, size_t n, char const *format, ...);
29 #if ! HAVE_VSNPRINTF /* GNU extension. */
30 int vsnprintf (char *str, size_t, char const *format, va_list args);
34 #if ! HAVE_ISINF /* BSD extension. */
43 #if ! HAVE_FOPENCOOKIE /* GNU extension. */
48 #if (! defined (__off64_t) && ! defined (__off64_t_defined)) || ! defined (__cplusplus)
49 #define off64_t unsigned long long
56 #if 1 //! HAVE_FUNOPEN
58 #define cookie_io_functions_t le_cookie_io_functions_t
61 ssize_t (*read) (void *, char *, size_t);
62 ssize_t (*write) (void *, char const *, size_t);
63 int (*seek) (void *, off64_t *, int);
64 int (*close) (void *);
65 } cookie_io_functions_t;
71 int (*read) (void *, char *, int);
72 int (*write) (void *, char const *, int);
73 fpos_t (*seek) (void *, fpos_t, int);
74 int (*close) (void *);
75 } cookie_io_functions_t;
77 #endif /* ! HAVE_FUNOPEN */
78 #endif /* ! HAVE_LIBIO_H */
80 FILE *fopencookie (void *cookie, char const *modes,
81 cookie_io_functions_t io_funcs);
85 int handle_cookie_io_fclose (FILE *);
86 int handle_cookie_io_fprintf (FILE *file, char const *format, ...);
87 int handle_cookie_io_putc (int c, FILE *file);
89 /* FIXME: ttftool uses fclose fopencookie fprintf and putc only. if
90 ALIAS_FILE_TO_FILECOOKIE, blondly redefine those functions
91 to wrappers that check for and handle Memory_out_stream. */
92 #ifdef ALIAS_FILE_TO_FILECOOKIE
94 #define fclose handle_cookie_io_fclose
95 #define fprintf handle_cookie_io_fprintf
100 #define putc handle_cookie_io_putc
102 #endif /* ALIAS_FILE_TO_FILECOOKIE */
103 #endif /* ! HAVE_FUNOPEN */
104 #endif /* ! HAVE_FOPENCOOKIE */
110 unsigned char *memrchr (unsigned char const *p, int n, char c);
111 unsigned char *strrev (unsigned char *byte, int length_i);
113 double my_round (double);
115 #endif /* LIBC_EXTENSION_HH */