[util] Add position_to_str()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-22 18:48:30 +02:00
parent e4d091ab2e
commit ae1cea061c
2 changed files with 20 additions and 0 deletions

View File

@ -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(<tt>n-1</tt>, \c l) characters from \c src into a newly

View File

@ -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 *);