check whether plname[] is among the list of generic user names */
| 39 | |
| 40 | /* check whether plname[] is among the list of generic user names */ |
| 41 | static bool generic_plname() |
| 42 | { |
| 43 | if (*svp.plname) { |
| 44 | const char *sptr, *p; |
| 45 | const char *genericusers = sysopt.genericusers; |
| 46 | int ln = (int) strlen(svp.plname); |
| 47 | |
| 48 | if (!genericusers || !*genericusers) |
| 49 | genericusers = "player games"; |
| 50 | else if (!strcmp(genericusers, "*")) /* "*" => always ask for name */ |
| 51 | return true; |
| 52 | |
| 53 | while ((sptr = strstri(genericusers, svp.plname)) != NULL) { |
| 54 | /* check for full word: start of list or following a space */ |
| 55 | if ((sptr == genericusers || sptr[-1] == ' ') |
| 56 | /* and also preceding a space or at end of list */ |
| 57 | && (sptr[ln] == ' ' || sptr[ln] == '\0')) |
| 58 | return true; |
| 59 | /* doesn't match full word, but maybe we got a false hit when |
| 60 | looking for "play" in list "player play" so keep going */ |
| 61 | if ((p = strchr(sptr + 1, ' ')) == NULL) |
| 62 | break; |
| 63 | genericusers = p + 1; |
| 64 | } |
| 65 | } |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | namespace nethack_qt_ { |
| 70 |