summaryrefslogtreecommitdiffstats
path: root/lib/controlfields
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-21 12:14:28 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-21 12:14:28 (EST)
commitd13e7b92e1dbfe412f0ef42e6e915a4feacdf174 (patch)
tree6e7b9f4b8e16aea6d8223dc504b5de05cb17e8bf /lib/controlfields
parenta54f1aa0967ed31611b87480236146e6ecbd661d (diff)
Write function 'oh_validate_pkg_name()'.
Diffstat (limited to 'lib/controlfields')
-rw-r--r--lib/controlfields12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/controlfields b/lib/controlfields
index 7eda765..a1a3f7b 100644
--- a/lib/controlfields
+++ b/lib/controlfields
@@ -108,3 +108,15 @@ ${_line}"
echo "${_value}"
return 0
}
+
+# Validates a package name.
+# Parameters:
+# package name
+# Return value:
+# 0 on valid name
+# 1 on invalid name
+oh_validate_pkg_name()
+{
+ {echo "${1}" | grep -E '^[a-z0-9][a-z0-9.+-]+$'} && return 0
+ return 1
+}