[PATCH] Add helper for file extension test

Implement COM_CheckExtension which does a case insensitive test of a
given filename for a particular file extension.

diff -urN a/NQ/common.c head/NQ/common.c
--- a/NQ/common.c	2005-12-28 12:35:38.000000000 +1030
+++ head/NQ/common.c	2006-01-21 21:30:06.000000000 +1030
@@ -783,6 +783,22 @@
     strcat(path, extension);
 }
 
+int
+COM_CheckExtension(char *path, char *extn)
+{
+    char *pos;
+    int ret = 0;
+
+    pos = strrchr(path, '.');
+    if (pos) {
+	if (extn[0] != '.')
+	    pos++;
+	ret = pos && !strcasecmp(pos, extn);
+    }
+
+    return ret;
+}
+
 //============================================================================
 
 char com_token[1024];
diff -urN a/NQ/common.h head/NQ/common.h
--- a/NQ/common.h	2005-12-28 12:35:38.000000000 +1030
+++ head/NQ/common.h	2006-01-21 21:24:40.000000000 +1030
@@ -142,6 +142,7 @@
 void COM_StripExtension(char *in, char *out);
 void COM_FileBase(const char *in, char *out);
 void COM_DefaultExtension(char *path, char *extension);
+int COM_CheckExtension(char *path, char *extn);
 
 char *va(char *format, ...);
 
diff -urN a/QW/client/common.h head/QW/client/common.h
--- a/QW/client/common.h	2005-12-28 12:35:38.000000000 +1030
+++ head/QW/client/common.h	2006-01-22 11:14:02.000000000 +1030
@@ -158,6 +158,7 @@
 void COM_StripExtension(const char *in, char *out);
 void COM_FileBase(const char *in, char *out);
 void COM_DefaultExtension(char *path, const char *extension);
+int COM_CheckExtension(char *path, char *extn);
 
 char *va(char *format, ...);
 
diff -urN a/QW/common/common.c head/QW/common/common.c
--- a/QW/common/common.c	2004-07-25 15:59:58.000000000 +0930
+++ head/QW/common/common.c	2006-01-21 21:50:55.000000000 +1030
@@ -889,6 +889,22 @@
     strcat(path, extension);
 }
 
+int
+COM_CheckExtension(char *path, char *extn)
+{
+    char *pos;
+    int ret = 0;
+
+    pos = strrchr(path, '.');
+    if (pos) {
+	if (extn[0] != '.')
+	    pos++;
+	ret = pos && !strcasecmp(pos, extn);
+    }
+
+    return ret;
+}
+
 //============================================================================
 
 char com_token[1024];
