summaryrefslogtreecommitdiff
path: root/common/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/path.c')
-rw-r--r--common/path.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/path.c b/common/path.c
index a2ba6ec..8362765 100644
--- a/common/path.c
+++ b/common/path.c
@@ -298,3 +298,20 @@ p11_path_parent (const char *path)
return_val_if_fail (parent != NULL, NULL);
return parent;
}
+
+bool
+p11_path_prefix (const char *string,
+ const char *prefix)
+{
+ int a, b;
+
+ return_val_if_fail (string != NULL, false);
+ return_val_if_fail (prefix != NULL, false);
+
+ a = strlen (string);
+ b = strlen (prefix);
+
+ return a > b &&
+ strncmp (string, prefix, b) == 0 &&
+ is_path_component_or_null (string[b]);
+}