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

Function is_valid_number

tools/ipfw/dummynet.c:779–789  ·  view source on GitHub ↗

* returns 1 if s is a non-negative number, with at least one '.' */

Source from the content-addressed store, hash-verified

777 * returns 1 if s is a non-negative number, with at least one '.'
778 */
779static int
780is_valid_number(const char *s)
781{
782 int i, dots_found = 0;
783 int len = strlen(s);
784
785 for (i = 0; i<len; ++i)
786 if (!isdigit(s[i]) && (s[i] !='.' || ++dots_found > 1))
787 return 0;
788 return 1;
789}
790
791/*
792 * Take as input a string describing a bandwidth value

Callers 2

load_extra_delaysFunction · 0.85
process_extra_parmsFunction · 0.85

Calls 1

isdigitFunction · 0.85

Tested by

no test coverage detected