]> sjero.net Git - wget/blobdiff - src/utils.c
[svn] Attempt to quote '?' as "%3F" when linking to local files.
[wget] / src / utils.c
index 444455a503f6528088cfa90ba8b4c4068943fe06..f602f046f20fd24740b18eeb55dbbd6091d9da69 100644 (file)
@@ -319,6 +319,19 @@ xstrdup_lower (const char *s)
   return copy;
 }
 
+/* Return a count of how many times CHR occurs in STRING. */
+
+int
+count_char (const char *string, char chr)
+{
+  const char *p;
+  int count = 0;
+  for (p = string; *p; p++)
+    if (*p == chr)
+      ++count;
+  return count;
+}
+
 /* Copy the string formed by two pointers (one on the beginning, other
    on the char after the last char) to a new, malloc-ed location.
    0-terminate it.  */