X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lib%2Fstr.h;h=0136569520486f3e5fc8d4ded9a6a461117412f3;hp=1beac83790c4aea914680f71bd10154f0cd62e9b;hb=643b8bf1557f533756a5563ff1e5c416561c58ed;hpb=bf962aa95d973d266241deb552e5e4ffae484692 diff --git a/lib-lib/str.h b/lib-lib/str.h index 1beac83..0136569 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -94,6 +94,16 @@ extern char const __m_b36chars_upper[36]; /* conversions */ /****************************************************************************/ +/** \brief Converts an octal digit into an int. + * \param[in] c the octal char + * \return + * - 0–7 if c is a valid octal digit, + * - -1 on error. + */ +static inline int octval(int c) { + return !(c & ~127) && __m_strdigits[c] < 7 ? __m_strdigits[c] : -1; +} + /** \brief Converts an hexadecimal digit into an int. * \param[in] c the hexadecimal char * \return