diff options
author | brooks <brooks@FreeBSD.org> | 2005-01-15 01:46:41 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2005-01-15 01:46:41 +0000 |
commit | a7b7255dba8fc4dbb902a3e1c18effdb1c509a49 (patch) | |
tree | 620ae0cde3ce5503f5c997ba925cc96926351339 /lib/libautofs | |
parent | 3e538fd2f77a3084e7dee8277f567fd9fc46ecb3 (diff) | |
download | FreeBSD-src-a7b7255dba8fc4dbb902a3e1c18effdb1c509a49.zip FreeBSD-src-a7b7255dba8fc4dbb902a3e1c18effdb1c509a49.tar.gz |
Deprecate unmaintainable uses of strncmp to implement abbreviations.
This commit replaces those with two new functions that simplify the code
and produce warnings that the syntax is deprecated. A small number of
sensible abbreviations may be explicitly added based on user feedback.
There were previously three types of strncmp use in ipfw:
- Most commonly, strncmp(av, "string", sizeof(av)) was used to allow av
to match string or any shortened form of it. I have replaced this
with a new function _substrcmp(av, "string") which returns 0 if av
is a substring of "string", but emits a warning if av is not exactly
"string".
- The next type was two instances of strncmp(av, "by", 2) which allowed
the abbreviation of bytes to "by", "byt", etc. Unfortunately, it
also supported "bykHUygh&*g&*7*ui". I added a second new function
_substrcmp2(av, "by", "bytes") which acts like the strncmp did, but
complains if the user doesn't spell out the word "bytes".
- There is also one correct use of strncmp to match "table(" which might
have another token after it without a space.
Since I changed all the lines anyway, I also fixed the treatment of
strncmp's return as a boolean in many cases. I also modified a few
strcmp cases as well to be fully consistent.
Diffstat (limited to 'lib/libautofs')
0 files changed, 0 insertions, 0 deletions