Compatibility with glib-2.0.x - missing g_str_has_suffix().
authorshort <>
Wed, 24 Sep 2003 01:57:17 +0000 (01:57 +0000)
committershort <>
Wed, 24 Sep 2003 01:57:17 +0000 (01:57 +0000)
Makefile.am
configure.in
g_str_has_suffix.c [new file with mode: 0644]
modules/http-method.c

index 665b41b..afc6b66 100644 (file)
@@ -13,7 +13,8 @@ EXTRA_DIST =                                  \
        debian/gnome-vfs-httpcaptive.conffiles  \
        debian/gnome-vfs-httpcaptive.docs       \
        debian/gnome-vfs-httpcaptive.files      \
-       debian/rules
+       debian/rules                            \
+       g_str_has_suffix.c
 
 # Needed for dpkg-buildpackage(1):
 EXTRA_DIST+=debian/changelog
index 64cd955..f4818d4 100644 (file)
@@ -538,6 +538,8 @@ dnl End of IPv6 checks
 dnl ==============================================================================
 dnl Output files
 
+AC_REPLACE_FUNCS(g_str_has_suffix)
+
 AC_OUTPUT([
 Makefile
 gnome-vfs-httpcaptive.spec
diff --git a/g_str_has_suffix.c b/g_str_has_suffix.c
new file mode 100644 (file)
index 0000000..802a7a2
--- /dev/null
@@ -0,0 +1,61 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include <string.h>
+
+
+/**
+ * g_str_has_suffix:
+ * @str: a nul-terminated string.
+ * @suffix: the nul-terminated suffix to look for.
+ *
+ * Looks whether the string @str ends with @suffix.
+ *
+ * Return value: %TRUE if @str end with @suffix, %FALSE otherwise.
+ *
+ * Since: 2.2
+ **/
+gboolean
+g_str_has_suffix (const gchar  *str,
+                 const gchar  *suffix)
+{
+  int str_len;
+  int suffix_len;
+  
+  g_return_val_if_fail (str != NULL, FALSE);
+  g_return_val_if_fail (suffix != NULL, FALSE);
+
+  str_len = strlen (str);
+  suffix_len = strlen (suffix);
+
+  if (str_len < suffix_len)
+    return FALSE;
+
+  return strcmp (str + str_len - suffix_len, suffix) == 0;
+}
index c9de671..9431510 100644 (file)
 #include <unistd.h>
 #include <netdb.h>
 
+#ifndef HAVE_G_STR_HAS_SUFFIX
+gboolean g_str_has_suffix(const gchar *str, const gchar *suffix);
+#endif
+
 #ifdef DEBUG_HTTP_ENABLE
 void
 http_debug_printf (char *fmt, ...)