Split out is_printable_string() into util.c

This useful function is split out so it will be available to programs
other than ftdump.

Signed-off-by: Simon Glass <[email protected]>
Acked-by: David Gibson <[email protected]>
diff --git a/util.h b/util.h
index 9cead84..cc68933 100644
--- a/util.h
+++ b/util.h
@@ -1,6 +1,8 @@
 #ifndef _UTIL_H
 #define _UTIL_H
 
+#include <stdarg.h>
+
 /*
  * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
  *
@@ -53,4 +55,13 @@
 extern char *xstrdup(const char *s);
 extern char *join_path(const char *path, const char *name);
 
+/**
+ * Check a string of a given length to see if it is all printable and
+ * has a valid terminator.
+ *
+ * @param data	The string to check
+ * @param len	The string length including terminator
+ * @return 1 if a valid printable string, 0 if not */
+int util_is_printable_string(const void *data, int len);
+
 #endif /* _UTIL_H */