commit b7df3e8c42890de3468ccdd7c7b090dea08b23aa
parent 5884d061a776232ad7039b0ffa51e9b8894ad4ba
Author: bsandro <email@bsandro.tech>
Date: Sat, 3 Jan 2026 02:34:28 +0200
support for -h flag
Diffstat:
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/cli/Makefile b/cli/Makefile
@@ -19,8 +19,5 @@ clean:
$(NAME): $(OBJ)
$(CC) $(OBJ) -o ../$@ $(LDFLAGS) $(CFLAGS)
-strip: $(NAME)
- strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag ../$(NAME)
-
-run: strip
- ../$(NAME)
+run: $(NAME)
+ ../$(NAME) -h
diff --git a/cli/main.c b/cli/main.c
@@ -238,9 +238,9 @@ int save_file(AnimatedImage *img, char *out, int cols, int width) {
return write_webp(img, out, cols);
}
-void print_usage(void) {
+void print_usage(int code) {
printf("Usage: %s [-w MAX_WIDTH_PIXELS] [-c COLUMNS] [-o OUTPUT_FILE] input_file.webp\n", argv0);
- exit(1);
+ exit(code);
}
int main(int argc, char **argv) {
@@ -251,21 +251,24 @@ int main(int argc, char **argv) {
ARGBEGIN {
case 'o':
- out_path = EARGF(print_usage());
+ out_path = EARGF(print_usage(1));
break;
case 'c':
- cols = atoi(EARGF(print_usage()));
+ cols = atoi(EARGF(print_usage(1)));
break;
case 'w':
- max_width = atoi(EARGF(print_usage()));
+ max_width = atoi(EARGF(print_usage(1)));
break;
+ case 'h':
+ print_usage(0);
+ break;
default:
- print_usage();
+ print_usage(1);
} ARGEND;
if (in_path==NULL||(cols<=0 && max_width<=0)) {
puts("invalid arguments");
- print_usage();
+ print_usage(1);
return 1;
}
AnimatedImage img = { .path=in_path };