From f3b3ba220e14b1b5fe39f14d7e0f04c4713e10b5 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Wed, 7 Feb 2024 11:34:26 +0100 Subject: check for conflicting options added --- rpt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rpt.c b/rpt.c index 409a8cc..b35f492 100644 --- a/rpt.c +++ b/rpt.c @@ -193,6 +193,17 @@ copy_stdin() } } +void +check_u_f_conflict(void (*handle_error_f)(int status), long count) +{ + if ((handle_error_f == continue_on_error) && (count == LONG_MAX)) + { + fprintf(stderr, "rpt: -u and -f options both given, conflict, \ +see man rpt(1)\n"); + exit(EXIT_INVALID_ARG); + } +} + int main(int argc, char* argv[]) { @@ -231,6 +242,8 @@ main(int argc, char* argv[]) } } + check_u_f_conflict(handle_error_f, count); + if (strcount) { char *err = NULL; -- cgit v1.2.3