aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-31 17:38:04 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-31 17:38:04 +0100
commit740ccc108a3772bf7db5b87fac569f82e42c8324 (patch)
treebc29f700f2ef18af5621b04882bd5b766aec527f
parentc745fe4007617d03ee2cb28380b873f995c003c2 (diff)
Reformatted player_find_part_login()
-rw-r--r--FICS/playerdb.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index be83fe5..be6e18e 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -1007,29 +1007,32 @@ PUBLIC int player_find_bylogin(char *name)
return -1;
}
-PUBLIC int player_find_part_login(char *name)
+PUBLIC int
+player_find_part_login(char *name)
{
- int i;
- int found = -1;
+ int found = -1;
+ int i;
- i = player_find_bylogin(name);
- if (i >= 0)
- return i;
- for (i = 0; i < p_num; i++) {
- if ((parray[i].status == PLAYER_EMPTY) ||
- (parray[i].status == PLAYER_LOGIN) ||
- (parray[i].status == PLAYER_PASSWORD))
- continue;
- if (!parray[i].login)
- continue;
- if (!strncmp(parray[i].login, name, strlen(name))) {
- if (found >= 0) { /* Ambiguous */
- return -2;
- }
- found = i;
- }
- }
- return found;
+ if ((i = player_find_bylogin(name)) >= 0)
+ return i;
+
+ for (i = 0; i < p_num; i++) {
+ if (parray[i].status == PLAYER_EMPTY ||
+ parray[i].status == PLAYER_LOGIN ||
+ parray[i].status == PLAYER_PASSWORD)
+ continue;
+
+ if (!parray[i].login)
+ continue;
+
+ if (!strncmp(parray[i].login, name, strlen(name))) {
+ if (found >= 0) /* Ambiguous */
+ return -2;
+ found = i;
+ }
+ }
+
+ return found;
}
PUBLIC int