From fa3b1ef74882597d7e809fc0924bf5d66114f535 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 30 Apr 2023 15:51:58 -0400 Subject: update help messages and use addressing range for ed s command --- src/commands/printf.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/commands/printf.c') diff --git a/src/commands/printf.c b/src/commands/printf.c index 7539316..ce1631c 100644 --- a/src/commands/printf.c +++ b/src/commands/printf.c @@ -79,11 +79,19 @@ static void handle_slash(char n) { } } +static void help() { + printf("Usage printf FORMAT [ARG]...\n\n"); + printf("Format and print ARG(s) according to FORMAT (a-la C prinf)\n"); + exit(EXIT_SUCCESS); +} + COMMAND(print) { if (argc < 1) { error("usage: printf FORMAT [ARG]...\n"); } + if (streql("--help", argv[0])) help(); + size_t index = 0; int arg_index = 0; -- cgit v1.2.3-freya