commit ab0978fb4e739e2b629d864ae7022c16447a13fa
parent 6be8d4fdfc2ab2471371e4ec763dd5782971209d
Author: Quentin Rameau <quinq@fifth.space>
Date: Tue, 10 Nov 2015 17:15:24 +0100
Be more explicit on input field error
Print the value of the wrong input field in the error message
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/addrom.c b/addrom.c
@@ -111,14 +111,14 @@ main(int argc, char *argv[])
case 'c':
rom.chtitle = EARGF(usage());
if (strlen(rom.chtitle) > CHTITLESZ)
- die("Chinese title must be less then than %zu bytes\n",
- CHTITLESZ);
+ die("Chinese title must be less then than %zu bytes: "
+ "%s\n", CHTITLESZ, rom.chtitle);
break;
case 'e':
rom.entitle = EARGF(usage());
if (strlen(rom.entitle) > ENTITLESZ)
- die("English title must be less then than %zu bytes\n",
- ENTITLESZ);
+ die("English title must be less then than %zu bytes: "
+ "%s\n", ENTITLESZ, rom.entitle);
break;
case 'i':
in = EARGF(usage());
@@ -126,7 +126,7 @@ main(int argc, char *argv[])
case 'n':
place = strtoimax(EARGF(usage()), NULL, 10);
if (place < 1)
- die("Place must be superior to 0\n");
+ die("Place must be at least 1: %d\n", place);
break;
case 'o':
out = EARGF(usage());
@@ -134,8 +134,8 @@ main(int argc, char *argv[])
case 'r':
rom.romname = EARGF(usage());
if (strlen(rom.romname) > ROMNAMESZ)
- die("Rom name must be less then than %zu bytes\n",
- ROMNAMESZ);
+ die("Rom name must be less then than %zu bytes: %s\n",
+ ROMNAMESZ, rom.romname);
break;
default:
usage();