aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_pr2serr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sg_pr2serr.c')
-rw-r--r--lib/sg_pr2serr.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/sg_pr2serr.c b/lib/sg_pr2serr.c
index 79845335..ef533967 100644
--- a/lib/sg_pr2serr.c
+++ b/lib/sg_pr2serr.c
@@ -869,6 +869,25 @@ sgj_convert_to_snake_name(const char * in_name, char * sname,
return sname;
}
+bool
+sgj_is_snake_name(const char * in_name)
+{
+ size_t k;
+ size_t ln = strlen(in_name);
+ char c;
+
+ for (k = 0; k < ln; ++k) {
+ c = in_name[k];
+ if (((c >= '0') && (c <= '9')) ||
+ ((c >= 'a') && (c <= 'z')) ||
+ (c == '_'))
+ continue;
+ else
+ return false;
+ }
+ return true;
+}
+
/* This function tries to convert the 'in' C string to "snake_case"
* convention so the output 'out' only contains lower case ASCII letters,
* numerals and "_" as a separator. Any leading or trailing underscores