summaryrefslogtreecommitdiff
path: root/src/m_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/m_misc.c')
-rw-r--r--src/m_misc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/m_misc.c b/src/m_misc.c
index acab0a5b..9a5fb84a 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -198,3 +198,11 @@ char *M_TempFile(char *s)
return result;
}
+boolean M_StrToInt(const char *str, int *result)
+{
+ return sscanf(str, " 0x%x", result) == 1
+ || sscanf(str, " 0X%x", result) == 1
+ || sscanf(str, " 0%o", result) == 1
+ || sscanf(str, " %d", result) == 1;
+}
+