aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index cb4220c..1a0a6d0 100644
--- a/src/util.c
+++ b/src/util.c
@@ -320,3 +320,21 @@ list_attrs(FILE *fp)
fputc('\n', fp);
}
+char *
+canonattrname(char **attrs, const char *arg, char *delim, size_t *plen)
+{
+ size_t len = strlen(arg);
+ int i;
+
+ for (i = 0; attrs[i]; i++) {
+ size_t alen = delim ? strcspn(attrs[i], delim)
+ : strlen(attrs[i]);
+ if (alen == len && strncasecmp(arg, attrs[i], len) == 0) {
+ if (plen)
+ *plen = len;
+ return attrs[i];
+ }
+ }
+ return NULL;
+}
+

Return to:

Send suggestions and report system problems to the System administrator.