--------------------------------------------------------------------------- | Facility : libnform | Function : static int Compare(const unsigned char * s, | const unsigned char * buf, | bool ccase ) | | Description : Check whether or not the text in 'buf' matches the | text i
| 109 | | EXACT - buffer matches exactly |
| 110 | +--------------------------------------------------------------------------*/ |
| 111 | static int Compare(const unsigned char *s, const unsigned char *buf, |
| 112 | bool ccase) |
| 113 | { |
| 114 | SKIP_SPACE(buf); /* Skip leading spaces in both texts */ |
| 115 | SKIP_SPACE(s); |
| 116 | |
| 117 | if (*buf=='\0') |
| 118 | { |
| 119 | return (((*s)=='\0') ? EXACT : NOMATCH); |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | if (ccase) |
| 124 | { |
| 125 | while(*s++ == *buf) |
| 126 | { |
| 127 | if (*buf++=='\0') return EXACT; |
| 128 | } |
| 129 | } |
| 130 | else |
| 131 | { |
| 132 | while(toupper(*s++)==toupper(*buf)) |
| 133 | { |
| 134 | if (*buf++=='\0') return EXACT; |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | /* At this location buf points to the first character where it no longer |
| 139 | matches with s. So if only blanks are following, we have a partial |
| 140 | match otherwise there is no match */ |
| 141 | SKIP_SPACE(buf); |
| 142 | if (*buf) |
| 143 | return NOMATCH; |
| 144 | |
| 145 | /* If it happens that the reference buffer is at its end, the partial |
| 146 | match is actually an exact match. */ |
| 147 | return ((s[-1]=='\0') ? EXACT : PARTIAL); |
| 148 | } |
| 149 | |
| 150 | /*--------------------------------------------------------------------------- |
| 151 | | Facility : libnform |
no outgoing calls
no test coverage detected
searching dependent graphs…