| 1109 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 1110 | |
| 1111 | staticfn int |
| 1112 | score_wanted( |
| 1113 | boolean current_ver, |
| 1114 | int rank, |
| 1115 | struct toptenentry *t1, |
| 1116 | int playerct, |
| 1117 | const char **players, |
| 1118 | int uid) |
| 1119 | { |
| 1120 | const char *arg, *nxt; |
| 1121 | int i; |
| 1122 | |
| 1123 | if (current_ver && (t1->ver_major != VERSION_MAJOR |
| 1124 | || t1->ver_minor != VERSION_MINOR |
| 1125 | || t1->patchlevel != PATCHLEVEL)) |
| 1126 | return 0; |
| 1127 | |
| 1128 | if (sysopt.pers_is_uid && !playerct && t1->uid == uid) |
| 1129 | return 1; |
| 1130 | |
| 1131 | /* |
| 1132 | * FIXME: |
| 1133 | * This selection produces a union (OR) of criteria rather than |
| 1134 | * an intersection (AND). So |
| 1135 | * nethack -s -u igor -p Cav -r Hum |
| 1136 | * will list all entries for name igor regardless of role or race |
| 1137 | * plus all entries for cave dwellers regardless of name or race |
| 1138 | * plus all entries for humans regardless of name or role. |
| 1139 | * |
| 1140 | * It would be more useful if it only chose human cave dwellers |
| 1141 | * named igor. That would be pretty straightforward if only one |
| 1142 | * instance of each of the criteria were possible, but |
| 1143 | * nethack -s -u igor -u ayn -p Cav -p Pri -r Hum -r Dwa |
| 1144 | * should list human cave dwellers named igor and human cave |
| 1145 | * dwellers named ayn plus dwarven cave dwellers named igor and |
| 1146 | * dwarven cave dwellers named ayn plus human priest[esse]s named |
| 1147 | * igor and human priest[esse]s named ayn (the combination of |
| 1148 | * dwarven priest[esse]s doesn't occur but the selection can test |
| 1149 | * entries without being aware of such; it just won't find any |
| 1150 | * matches for that). An extra initial pass of the command line |
| 1151 | * to collect all criteria before testing any entry is needed to |
| 1152 | * accomplish this. And we might need to drop support for |
| 1153 | * pre-3.3.0 entries (old elf role) depending on how the criteria |
| 1154 | * matching is performed. |
| 1155 | * |
| 1156 | * It also ought to extended to handle |
| 1157 | * nethack -s -u igor-Cav-Hum |
| 1158 | * Alignment and gender could be useful too but no one has ever |
| 1159 | * clamored for them. Presumably if they care they postprocess |
| 1160 | * with some custom tool. |
| 1161 | */ |
| 1162 | |
| 1163 | for (i = 0; i < playerct; i++) { |
| 1164 | arg = players[i]; |
| 1165 | if (arg[0] == '-' && arg[1] == 'u' && arg[2] != '\0') |
| 1166 | arg += 2; /* handle '-uname' */ |
| 1167 | |
| 1168 | if (arg[0] == '-' && strchr("pru", arg[1]) && !arg[2] |