examples: exit w/failure w/no args

cwebp, gif2webp, img2webp, vwebp and webpinfo are modified in this
change to align with the other examples. When given no arguments, the
examples print their help output and exit with failure.

Bug: webp:42340557, webp:381372617
Change-Id: Ifed4eb79e98233f7aa780c42e489636d0cf4a035
This commit is contained in:
James Zern 2024-12-06 13:11:29 -08:00
parent fcff86c71b
commit da0d9c7d4e
6 changed files with 12 additions and 4 deletions

View File

@ -698,7 +698,7 @@ int main(int argc, const char* argv[]) {
if (argc == 1) {
HelpShort();
FREE_WARGV_AND_RETURN(EXIT_SUCCESS);
FREE_WARGV_AND_RETURN(EXIT_FAILURE);
}
for (c = 1; c < argc; ++c) {

View File

@ -158,7 +158,7 @@ int main(int argc, const char* argv[]) {
if (argc == 1) {
Help();
FREE_WARGV_AND_RETURN(EXIT_SUCCESS);
FREE_WARGV_AND_RETURN(EXIT_FAILURE);
}
for (c = 1; c < argc; ++c) {

View File

@ -229,6 +229,8 @@ int main(int argc, const char* argv[]) {
}
if (!have_input) {
fprintf(stderr, "No input file(s) for generating animation!\n");
ok = 0;
Help();
goto End;
}

View File

@ -568,7 +568,7 @@ int main(int argc, char* argv[]) {
if (kParams.file_name == NULL) {
printf("missing input file!!\n");
Help();
FREE_WARGV_AND_RETURN(EXIT_SUCCESS);
FREE_WARGV_AND_RETURN(EXIT_FAILURE);
}
if (!ImgIoUtilReadFile(kParams.file_name,

View File

@ -1132,7 +1132,7 @@ int main(int argc, const char* argv[]) {
if (argc == 1) {
Help();
FREE_WARGV_AND_RETURN(EXIT_SUCCESS);
FREE_WARGV_AND_RETURN(EXIT_FAILURE);
}
// Parse command-line input.

View File

@ -57,6 +57,12 @@ int main(int argc, char* argv[]) {
INIT_WARGV(argc, argv);
if (argc == 1) {
fprintf(stderr, "Usage: %s [-h] image.webp [more_files.webp...]\n",
argv[0]);
goto Error;
}
for (c = 1; c < argc; ++c) {
const char* file = NULL;
const uint8_t* webp = NULL;