* _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 *
| 851 | * deprecation process. |
| 852 | */ |
| 853 | int |
| 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 |
no test coverage detected