summaryrefslogtreecommitdiff
path: root/src/commands/printf.c
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-04-30 15:51:58 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-04-30 15:51:58 -0400
commitfa3b1ef74882597d7e809fc0924bf5d66114f535 (patch)
treef6a8b194dfb40cd27bf9a8ab2bb5153b93ccddef /src/commands/printf.c
parentfinish ed (diff)
downloadlazysphere-fa3b1ef74882597d7e809fc0924bf5d66114f535.tar.gz
lazysphere-fa3b1ef74882597d7e809fc0924bf5d66114f535.tar.bz2
lazysphere-fa3b1ef74882597d7e809fc0924bf5d66114f535.zip
update help messages and use addressing range for ed s command
Diffstat (limited to 'src/commands/printf.c')
-rw-r--r--src/commands/printf.c8
1 files changed, 8 insertions, 0 deletions
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;