1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/sourcemm/util.cpp Sat Apr 16 19:59:26 2005 +0000
1.3 @@ -0,0 +1,39 @@
1.4 +/* ======== SourceMM ========
1.5 +* Copyright (C) 2004-2005 SourceMM Development Team
1.6 +* No warranties of any kind
1.7 +*
1.8 +* License: zlib/libpng
1.9 +*
1.10 +* Author(s): David "BAILOPAN" Anderson
1.11 +* ============================
1.12 +*/
1.13 +
1.14 +#include <string.h>
1.15 +#include "util.h"
1.16 +
1.17 +/**
1.18 + * @brief Utility functons
1.19 + * @file util.cpp
1.20 + */
1.21 +
1.22 +/* UTIL_GetExtension
1.23 + * Returns a pointer to the extension in a file name
1.24 + */
1.25 +const char *UTIL_GetExtension(const char *file)
1.26 +{
1.27 + int len = strlen(file);
1.28 + int i = 0;
1.29 +
1.30 + for (i=len-1; i>=0; i--)
1.31 + {
1.32 + if (file[i] == '/' || file[i] == '\\')
1.33 + return NULL;
1.34 +
1.35 + if ((file[i] == '.') && (i != len-1))
1.36 + {
1.37 + return (const char *)&(file[i+1]);
1.38 + }
1.39 + }
1.40 +
1.41 + return NULL;
1.42 +}
1.43 \ No newline at end of file