From ae1cea061c6a05fc6b9253f7936117718ce35571 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 22 Apr 2008 18:48:30 +0200 Subject: [PATCH] [util] Add position_to_str() Signed-off-by: Julien Danjou --- common/util.c | 19 +++++++++++++++++++ common/util.h | 1 + 2 files changed, 20 insertions(+) diff --git a/common/util.c b/common/util.c index 293959c20..c6190a413 100644 --- a/common/util.c +++ b/common/util.c @@ -112,6 +112,25 @@ position_get_from_str(const char *pos) return Off; } +char * +position_to_str(position_t p) +{ + switch(p) + { + case Top: + return a_strdup("top"); + case Bottom: + return a_strdup("bottom"); + case Right: + return a_strdup("right"); + case Left: + return a_strdup("left"); + case Auto: + return a_strdup("auto"); + } + return a_strdup("off"); +} + /** \brief safe limited strdup. * * Copies at most min(n-1, \c l) characters from \c src into a newly diff --git a/common/util.h b/common/util.h index 122af3f15..940b1eac3 100644 --- a/common/util.h +++ b/common/util.h @@ -261,6 +261,7 @@ void _warn(int, const char *, const char *, ...) __attribute__ ((format(printf, 3, 4))); position_t position_get_from_str(const char *); +char * position_to_str(position_t); fuzzy_t fuzzy_get_from_str(const char *); double compute_new_value_from_arg(const char *, double); void *name_func_lookup(const char *, const name_func_link_t *);