- while (lp != NULL && lp->s != NULL) {
- tokval=lp->v; /* load our first value */
- rotbit=1;
- while (rotbit != 0) {
- /*
- * lets AND the rotating bit with our token value
- * and see if we have got a match
- */
- if (tokval == (v&rotbit)) {
- /* ok we have found something */
- if (space_left <= 1)
- return (buf); /* only enough room left for NUL, if that */
- string_size = strlcpy(bufp, sepstr, space_left);
- if (string_size >= space_left)
- return (buf); /* we ran out of room */
- bufp += string_size;
- space_left -= string_size;
- if (space_left <= 1)
- return (buf); /* only enough room left for NUL, if that */
- string_size = strlcpy(bufp, lp->s, space_left);
- if (string_size >= space_left)
- return (buf); /* we ran out of room */
- bufp += string_size;
- space_left -= string_size;
- sepstr = sep;
- break;
- }
- rotbit=rotbit<<1; /* no match - lets shift and try again */
+ while (lp != NULL && lp->s != NULL) {
+ if (lp->v && (v & lp->v) == lp->v) {
+ /* ok we have found something */
+ if (space_left <= 1)
+ return (buf); /* only enough room left for NUL, if that */
+ string_size = strlcpy(bufp, sepstr, space_left);
+ if (string_size >= space_left)
+ return (buf); /* we ran out of room */
+ bufp += string_size;
+ space_left -= string_size;
+ if (space_left <= 1)
+ return (buf); /* only enough room left for NUL, if that */
+ string_size = strlcpy(bufp, lp->s, space_left);
+ if (string_size >= space_left)
+ return (buf); /* we ran out of room */
+ bufp += string_size;
+ space_left -= string_size;
+ sepstr = sep;