logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: b8db9446ae0c9104d5aa677b61b2cfa903c16e5f
parent 2892fdc2ad1fec5a298a8d3719669a801e0bd535
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  3 Jun 2023 06:28:44 +0200

cmd/touch: Handle bad options and missing operands

Diffstat:

Mcmd/touch.c6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/cmd/touch.c b/cmd/touch.c @@ -111,6 +111,12 @@ main(int argc, char *argv[]) case 'd': target = iso_parse(optarg); break; + case ':': + fprintf(stderr, "touch: Error: Missing operand for option: '-%c'\n", optopt); + return 1; + case '?': + fprintf(stderr, "touch: Error: Unrecognised option: '-%c'\n", optopt); + return 1; } }