diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-09-21 18:00:16 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-09-21 18:00:16 +0000 |
commit | 3a2be6f9d910b862d4e5ea237d734315627dd661 (patch) | |
tree | 0525085036572441949db4493a31afa5c8813a91 /lib/util | |
parent | 3aa04aa72c6ec522395919d528dfce6a92b0de98 (diff) | |
download | netpbm-mirror-3a2be6f9d910b862d4e5ea237d734315627dd661.tar.gz netpbm-mirror-3a2be6f9d910b862d4e5ea237d734315627dd661.tar.xz netpbm-mirror-3a2be6f9d910b862d4e5ea237d734315627dd661.zip |
Release 10.36.0
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@65 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/Makefile | 6 | ||||
-rw-r--r-- | lib/util/nstring.c | 26 | ||||
-rw-r--r-- | lib/util/nstring.h | 9 |
3 files changed, 29 insertions, 12 deletions
diff --git a/lib/util/Makefile b/lib/util/Makefile index 8f461f28..ffa1db5b 100644 --- a/lib/util/Makefile +++ b/lib/util/Makefile @@ -7,11 +7,9 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/Makefile.config -INCLUDES = -I $(BUILDDIR) -I $(SRCDIR)/$(SUBDIR)/.. - # nstring is required for asprintf(), etc. Also some systems don't have # snprintf(), e.g. Solaris 2.5.1. 2002.03.29. -UTILOBJECTS = shhopt.o nstring.o filename.o +UTILOBJECTS = shhopt.o nstring.o vasprintf.o filename.o MERGE_OBJECTS = @@ -19,6 +17,8 @@ all: $(UTILOBJECTS) include $(SRCDIR)/Makefile.common +INCLUDES = -I $(BUILDDIR) -I $(SRCDIR)/$(SUBDIR)/.. + $(UTILOBJECTS):%.o:%.c importinc $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) $(CFLAGS_SHLIB) \ $(CFLAGS_PERSONAL) $(CADD) -o $@ $< diff --git a/lib/util/nstring.c b/lib/util/nstring.c index 702a3c44..58500547 100644 --- a/lib/util/nstring.c +++ b/lib/util/nstring.c @@ -740,15 +740,6 @@ const char * const strsol = "NO MEMORY TO CREATE STRING!"; -/* We would like to have vasprintfN(), but it is difficult because you - can't run through a va_list twice, which we would want to do: once - to measure the length; once actually to build the string. On some - machines, you can simply make two copies of the va_list variable in - normal C fashion, but on others you need va_copy, which is a - relatively recent invention. In particular, the simple va_list copy - failed on an AMD64 Gcc Linux system in March 2006. -*/ - void PM_GNU_PRINTF_ATTR(2,3) asprintfN(const char ** const resultP, const char * const fmt, @@ -904,3 +895,20 @@ memmemN(const char * const haystack, return NULL; } + + + +bool +strishex(const char * const subject) { + + bool retval; + unsigned int i; + + retval = TRUE; /* initial assumption */ + + for (i = 0; i < strlen(subject); ++i) + if (!ISXDIGIT(subject[i])) + retval = FALSE; + + return retval; +} diff --git a/lib/util/nstring.h b/lib/util/nstring.h index 9ed20051..70a53f45 100644 --- a/lib/util/nstring.h +++ b/lib/util/nstring.h @@ -5,6 +5,7 @@ #include <string.h> #include <ctype.h> +#include "pm_c_util.h" #include "pm.h" /* For PM_GNU_PRINTF_ATTR, __inline__ */ #ifdef __cplusplus @@ -134,6 +135,11 @@ asprintfN(const char ** const resultP, const char * const fmt, ...) PM_GNU_PRINTF_ATTR(2,3); +void +vasprintfN(const char ** const resultP, + const char * const format, + va_list args); + void strfree(const char * const string); @@ -150,6 +156,9 @@ memmemN(const char * const haystack, const char * const needle, size_t const needlelen); +bool +strishex(const char * const subject); + #ifdef __cplusplus } #endif |