summaryrefslogtreecommitdiff
path: root/src/commands/printf.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;