| 940 | } |
| 941 | |
| 942 | int |
| 943 | str2align(const char *str) |
| 944 | { |
| 945 | int i, len; |
| 946 | |
| 947 | /* Is str valid? */ |
| 948 | if (!str || !str[0]) |
| 949 | return ROLE_NONE; |
| 950 | |
| 951 | /* Match as much of str as is provided */ |
| 952 | len = Strlen(str); |
| 953 | for (i = 0; i < ROLE_ALIGNS; i++) { |
| 954 | /* Does it match the adjective? */ |
| 955 | if (!strncmpi(str, aligns[i].adj, len)) |
| 956 | return i; |
| 957 | /* Or the filecode? */ |
| 958 | if (!strcmpi(str, aligns[i].filecode)) |
| 959 | return i; |
| 960 | } |
| 961 | if ((len == 1 && (*str == '*' || *str == '@')) |
| 962 | || !strncmpi(str, randomstr, len)) |
| 963 | return ROLE_RANDOM; |
| 964 | |
| 965 | /* Couldn't find anything appropriate */ |
| 966 | return ROLE_NONE; |
| 967 | } |
| 968 | |
| 969 | /* is rolenum compatible with any racenum/gendnum/alignnum constraints? */ |
| 970 | boolean |
no test coverage detected