summaryrefslogtreecommitdiffstats
path: root/common/util.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2005-06-01 17:46:01 +0200
committerWerner Koch <wk@gnupg.org>2005-06-01 17:46:01 +0200
commitcad9562436e61cdaf1a2f03ba96bcc82077205e6 (patch)
tree6db1dde6998d0ad1ae13a4581f66cace736a2399 /common/util.h
parent* agent.h (out_of_core): s/__inline__/inine. Noted by Ray Link. (diff)
downloadgnupg2-cad9562436e61cdaf1a2f03ba96bcc82077205e6.tar.xz
gnupg2-cad9562436e61cdaf1a2f03ba96bcc82077205e6.zip
* configure.ac (gl_INIT): Add gnulib stuff.
(fseeko, ftello, ttyname, isascii): Replaced the AC_REPLACE_FUNCS by a simple check. (putc_unlocked): Removed check. Not used. (strsep, mkdtemp, asprintf): Replaced checks by gnulib checks. (xsize): Added will probably come handy soon. (CFLAGS): Use -Wformat-security instead of -Wformat-nonliteral. Add --Wno-format-y2k. * gl/, gl/m4/: New. * gpg-agent.c: Include setenv.h. * Makefile.am (AM_CPPFLAGS): Added. * util.h: Add some includes for gnulib. (ttyname, isascii): Define them inline. * fseeko.c, ftello.c: Removed. * strsep.c, mkdtemp.c: Removed. * ttyname.c, isascii.c: Removed. * mkdtemp.c: Removed. * exec.c: Include mkdtemp.h * keybox-file.c (ftello) [!HAVE_FSEEKO]: New replacement function. Copied from ../common/ftello.c. * keybox-update.c (fseeko) [!HAVE_FSEEKO]: New replacement function. Copied from ../common/iobuf.c. * scdaemon.c: Include mkdtemp.h. * misc.c: Include setenv.h. * symcryptrun.c: Include mkdtemp.h.
Diffstat (limited to 'common/util.h')
-rw-r--r--common/util.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/common/util.h b/common/util.h
index 6a9b54ef5..d233dbf5e 100644
--- a/common/util.h
+++ b/common/util.h
@@ -25,7 +25,13 @@
#include <time.h> /* We need time_t. */
#include <gpg-error.h> /* we need gpg-error_t. */
-/* to pass hash functions to libksba we need to cast it */
+/* Common GNUlib includes (-I ../gl/). */
+#include "strpbrk.h"
+#include "strsep.h"
+#include "vasprintf.h"
+
+
+/* Hash function used with libksba. */
#define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write)
/* get all the stuff from jnlib */
@@ -152,24 +158,26 @@ char *make_printable_string (const byte *p, size_t n, int delim);
int is_file_compressed (const char *s, int *ret_rc);
-/*-- replacement functions from funcname.c --*/
-#if !HAVE_VASPRINTF
-#include <stdarg.h>
-int vasprintf (char **result, const char *format, va_list args);
-int asprintf (char **result, const char *format, ...) JNLIB_GCC_A_PRINTF(2,3);
-#endif
-#ifndef HAVE_STRSEP
-char *strsep (char **stringp, const char *delim);
-#endif
+
+/*-- Simple replacement functions. */
#ifndef HAVE_TTYNAME
-char *ttyname (int fd);
-#endif
-#ifndef HAVE_MKDTEMP
-char *mkdtemp (char *template);
-#endif
+/* Systems without ttyname (W32) will merely return NULL. */
+static inline char *
+ttyname (int fd)
+{
+ return NULL
+};
+#endif /* !HAVE_TTYNAME */
+#ifndef HAVE_ISASCII
+static inline int
+isascii (int c)
+{
+ return (((c) & ~0x7f) == 0);
+}
+#endif /* !HAVE_ISASCII */
-/*-- some macros to replace ctype ones and avoid locale problems --*/
+/*-- Macros to replace ctype ones to avoid locale problems. --*/
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
#define digitp(p) (*(p) >= '0' && *(p) <= '9')
#define hexdigitp(a) (digitp (a) \