diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-04-07 12:30:32 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-04-07 12:30:32 +0000 |
commit | aaaad5c4d2196adb4907f09d161bf8f9146fa0ae (patch) | |
tree | 3e20b8f6bf0ce96dffe78c2ae017bd1354cb267c | |
parent | 4a61c1fb778daadd536ef67b434404f4c29b3dd4 (diff) | |
download | execline-aaaad5c4d2196adb4907f09d161bf8f9146fa0ae.tar.gz execline-aaaad5c4d2196adb4907f09d161bf8f9146fa0ae.tar.xz execline-aaaad5c4d2196adb4907f09d161bf8f9146fa0ae.zip |
Better error reporting in execlineb
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | src/execline/execlineb.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/execline/execlineb.c b/src/execline/execlineb.c index c115b72..89688f6 100644 --- a/src/execline/execlineb.c +++ b/src/execline/execlineb.c @@ -105,7 +105,18 @@ int main (int argc, char const *const *argv, char const *const *envp) } argc -= l.ind ; argv += l.ind ; } - if (stringarg) nc = el_parse_from_string(&sa, stringarg) ; + if (stringarg) + { + nc = el_parse_from_string(&sa, stringarg) ; + switch (nc) + { + case -4: strerr_dief2x(100, "unmatched ", "}") ; + case -3: strerr_dief2x(100, "unmatched ", "{") ; + case -2: strerr_dief1x(100, "syntax error") ; + case -1: strerr_diefu1sys(111, "parse script") ; + case 0 : return 0 ; + } + } else { char buf[BUFFER_INSIZE] ; @@ -118,15 +129,14 @@ int main (int argc, char const *const *argv, char const *const *envp) buffer_init(&b, &fd_readv, fd, buf, BUFFER_INSIZE) ; nc = el_parse_from_buffer(&sa, &b) ; fd_close(fd) ; - } - - switch (nc) - { - case -4: strerr_dief2x(100, "unmatched ", "}") ; - case -3: strerr_dief2x(100, "unmatched ", "{") ; - case -2: strerr_dief1x(100, "syntax error") ; - case -1: strerr_diefu1sys(111, "parse script") ; - case 0 : return 0 ; + switch (nc) + { + case -4: strerr_dief4x(100, "unmatched ", "}", " in file ", dollar0) ; + case -3: strerr_dief4x(100, "unmatched ", "{", " in file ", dollar0) ; + case -2: strerr_dief3x(100, "syntax error", " in file ", dollar0) ; + case -1: strerr_diefu3sys(111, "parse script", " in file ", dollar0) ; + case 0 : return 0 ; + } } if (flagstrict >= 0) |