diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 8 | ||||
-rw-r--r-- | util/Makefile.am | 15 | ||||
-rw-r--r-- | util/compat.c | 24 | ||||
-rw-r--r-- | util/miscutil.c | 25 |
4 files changed, 44 insertions, 28 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 426d4d3c9..671b51bb0 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,11 @@ +2006-09-28 David Shaw <[email protected]> + + * Makefile.am: Build libcompat.a for keyserver helpers. libutil.a + always contains everything in libcompat.a, so we only need to link + to one or the other. + + * miscutil.c: Move hextobyte to new file compat.c. + 2006-07-31 Werner Koch <[email protected]> * iobuf.c (iobuf_ioctl, fd_cache_invalidate): Allow closing all diff --git a/util/Makefile.am b/util/Makefile.am index 48457c29f..1da5a1075 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -20,11 +20,12 @@ INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/intl -noinst_LIBRARIES = libutil.a +noinst_LIBRARIES = libutil.a libcompat.a libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \ ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \ - dotlock.c http.c pka.c membuf.c cert.c + dotlock.c http.c pka.c membuf.c cert.c \ + $(libcompat_a_SOURCES) if USE_SIMPLE_GETTEXT libutil_a_SOURCES+=simple-gettext.c @@ -52,10 +53,18 @@ endif EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \ regex_internal.h -# LIBOBJS is for the replacement functions +# LIBOBJS and libcompat.a are for the replacement functions and +# similar simple stuff. They're segregated in libcompat so we can +# link it to the keyserver helpers which have different licensing. +# libutil.a, by definition, includes everything that libcompat.a does. + libutil_a_DEPENDENCIES = @LIBOBJS@ libutil_a_LIBADD = @LIBOBJS@ +libcompat_a_SOURCES=compat.c +libcompat_a_DEPENDENCIES = @LIBOBJS@ +libcompat_a_LIBADD = @LIBOBJS@ + http-test: http.c cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \ -DTEST -o http-test http.c libutil.a @LIBINTL@ @DNSLIBS@ @CAPLIBS@ diff --git a/util/compat.c b/util/compat.c new file mode 100644 index 000000000..aca558aee --- /dev/null +++ b/util/compat.c @@ -0,0 +1,24 @@ +int +hextobyte (const char *s) +{ + int c; + + if ( *s >= '0' && *s <= '9' ) + c = 16 * (*s - '0'); + else if ( *s >= 'A' && *s <= 'F' ) + c = 16 * (10 + *s - 'A'); + else if ( *s >= 'a' && *s <= 'f' ) + c = 16 * (10 + *s - 'a'); + else + return -1; + s++; + if ( *s >= '0' && *s <= '9' ) + c += *s - '0'; + else if ( *s >= 'A' && *s <= 'F' ) + c += 10 + *s - 'A'; + else if ( *s >= 'a' && *s <= 'f' ) + c += 10 + *s - 'a'; + else + return -1; + return c; +} diff --git a/util/miscutil.c b/util/miscutil.c index 698e80691..01241bc23 100644 --- a/util/miscutil.c +++ b/util/miscutil.c @@ -453,28 +453,3 @@ match_multistr(const char *multistr,const char *match) return 0; } - -int -hextobyte( const char *s ) -{ - int c; - - if( *s >= '0' && *s <= '9' ) - c = 16 * (*s - '0'); - else if( *s >= 'A' && *s <= 'F' ) - c = 16 * (10 + *s - 'A'); - else if( *s >= 'a' && *s <= 'f' ) - c = 16 * (10 + *s - 'a'); - else - return -1; - s++; - if( *s >= '0' && *s <= '9' ) - c += *s - '0'; - else if( *s >= 'A' && *s <= 'F' ) - c += 10 + *s - 'A'; - else if( *s >= 'a' && *s <= 'f' ) - c += 10 + *s - 'a'; - else - return -1; - return c; -} |