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

Function _substrcmp2

tools/ipfw/ipfw2.c:853–864  ·  view source on GitHub ↗

* _substrcmp2 takes three strings and returns 1 if the first two do not match, * and 0 if they match exactly or the second string is a sub-string * of the first. A warning is printed to stderr in the case that the * first string does not match the third. * * This function exists to warn about the bizarre construction * strncmp(str, "by", 2) which is used to allow people to use a shortcut *

Source from the content-addressed store, hash-verified

851 * deprecation process.
852 */
853int
854_substrcmp2(const char *str1, const char* str2, const char* str3)
855{
856
857 if (strncmp(str1, str2, strlen(str2)) != 0)
858 return 1;
859
860 if (strcmp(str1, str3) != 0)
861 warnx("DEPRECATED: '%s' matched '%s'",
862 str1, str3);
863 return 0;
864}
865
866/*
867 * prints one port, symbolic or numeric

Callers 2

read_bandwidthFunction · 0.85
ipfw_config_pipeFunction · 0.85

Calls 2

strncmpFunction · 0.85
strcmpFunction · 0.85

Tested by

no test coverage detected