MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / env_bare_name

Function env_bare_name

internal/cbm/helpers.c:2163–2175  ·  view source on GitHub ↗

A bare DNS name: `[a-z0-9][a-z0-9-]*(\.[a-z0-9-]+)*`, not only digits. */

Source from the content-addressed store, hash-verified

2161
2162/* A bare DNS name: `[a-z0-9][a-z0-9-]*(\.[a-z0-9-]+)*`, not only digits. */
2163static bool env_bare_name(const char *v) {
2164 bool digits_only = true;
2165 if (!env_label_char(v[0]) || v[0] == '-') {
2166 return false;
2167 }
2168 for (const char *p = v; *p; p++) {
2169 if (*p == '.' ? (p[SKIP_ONE] == '\0' || p[SKIP_ONE] == '.') : !env_label_char(*p)) {
2170 return false;
2171 }
2172 digits_only = digits_only && (isdigit((unsigned char)*p) || *p == '.');
2173 }
2174 return !digits_only;
2175}
2176
2177static bool env_copy(char *out, size_t sz, const char *s, size_t n) {
2178 if (n == 0 || n >= sz) {

Callers 1

cbm_env_addressFunction · 0.85

Calls 1

env_label_charFunction · 0.85

Tested by

no test coverage detected