MCPcopy Create free account
hub / github.com/F-Stack/f-stack / isDISP

Function isDISP

tools/libutil/trimdomain.c:98–117  ·  view source on GitHub ↗

* Is the given string NN or NN.NN where ``NN'' is an all-numeric string ? */

Source from the content-addressed store, hash-verified

96 * Is the given string NN or NN.NN where ``NN'' is an all-numeric string ?
97 */
98static int
99isDISP(const char *disp)
100{
101 size_t w;
102 int res;
103
104 w = strspn(disp, "0123456789");
105 res = 0;
106 if (w > 0) {
107 if (disp[w] == '\0')
108 res = 1; /* NN */
109 else if (disp[w] == '.') {
110 disp += w + 1;
111 w = strspn(disp, "0123456789");
112 if (w > 0 && disp[w] == '\0')
113 res = 1; /* NN.NN */
114 }
115 }
116 return (res);
117}

Callers 1

trimdomainFunction · 0.85

Calls 1

strspnFunction · 0.85

Tested by

no test coverage detected