diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-01-01 12:10:36 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-01-01 12:10:36 +0100 |
commit | a39e85ee3319ce779bebf1234ed3b671947cae18 (patch) | |
tree | 25c70a6aea52887b000b68d7e77f7adcabf5849a /FICS | |
parent | 9871e797d1154a278718f9eee80a19f530af1b97 (diff) |
Switched to usage of errx()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/fics_addplayer.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/FICS/fics_addplayer.c b/FICS/fics_addplayer.c index 44690b0..a711396 100644 --- a/FICS/fics_addplayer.c +++ b/FICS/fics_addplayer.c @@ -94,26 +94,21 @@ main(int argc, char *argv[]) usage(argv[0]); /* Add the player here */ - if (strlen(funame) >= MAX_LOGIN_NAME) { - fprintf(stderr, "Player name is too long\n"); - exit(0); - } - if (strlen(funame) < 3) { - fprintf(stderr, "Player name is too short\n"); - exit(0); - } - if (!alphastring(funame)) { - fprintf(stderr, "Illegal characters in player name. " - "Only A-Za-z allowed.\n"); - exit(0); + if (strlen(funame) >= MAX_LOGIN_NAME) + errx(1, "Player name is too long"); + else if (strlen(funame) < 3) + errx(1, "Player name is too short"); + else if (!alphastring(funame)) { + errx(1, "Illegal characters in player name. " + "Only A-Za-z allowed."); } player_init(0); p = player_new(); - if (!player_read(p, funame)) { - fprintf(stderr, "%s already exists.\n", funame); - exit(0); - } + + if (!player_read(p, funame)) + errx(1, "%s already exists.", funame); + parray[p].name = xstrdup(funame); parray[p].login = xstrdup(funame); stolower(parray[p].login); |