diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-06 02:41:03 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-06 02:41:03 +0200 |
commit | 5af98f828476716954f327c479c4cf6321ae3fe4 (patch) | |
tree | 06195370467c227dec54ff8ca7d8d43dbd9b17dc /util.c | |
parent | a9a1e00af1059a6b8c3e089238870fbf2608c087 (diff) |
util: add decchar()/undecchar() calls
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -701,6 +701,18 @@ int unoctchar(char c) { return -1; } +char decchar(int x) { + return '0' + (x % 10); +} + +int undecchar(char c) { + + if (c >= '0' && c <= '9') + return c - '0'; + + return -1; +} + char *cescape(const char *s) { char *r, *t; const char *f; |