chiark / gitweb /
add new hexchar() call
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Jan 2010 05:45:04 +0000 (06:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Jan 2010 05:45:04 +0000 (06:45 +0100)
util.c
util.h

diff --git a/util.c b/util.c
index 654b93d79c084ceb25b944aa3e62a1112204303a..b166f328b2e50a4736cda93676b96fc097d0ed0a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -547,3 +547,9 @@ char *file_in_same_dir(const char *path, const char *filename) {
 
         return r;
 }
+
+char hexchar(int x) {
+        static const char table[16] = "0123456789abcdef";
+
+        return table[x & 15];
+}
diff --git a/util.h b/util.h
index c3d3aad7b9a24d7ccc652ed09167da9500213966..fcf380031d8d3f1c09b86058e0dacc598c408e57 100644 (file)
--- a/util.h
+++ b/util.h
@@ -105,4 +105,6 @@ int reset_all_signal_handlers(void);
 char *strstrip(char *s);
 char *file_in_same_dir(const char *path, const char *filename);
 
+char hexchar(int x);
+
 #endif