fix: version return with 0

This commit is contained in:
Renge 2022-03-04 21:46:14 -05:00
parent 3c17961c60
commit c63ef04b44

View File

@ -392,7 +392,7 @@ static int setOptions(int argc, char **argv, int *widthbak, int *prefixbak, int
set_error(buf); set_error(buf);
fclose(stream); fclose(stream);
free(buf); free(buf);
return 0; return 2;
break; break;
case 'W': case 'W':
if (!setValue(widthbak, optarg, "width")) if (!setValue(widthbak, optarg, "width"))
@ -538,7 +538,8 @@ int original_main(int argc, const char *const *argv)
// goto parcleanup; // goto parcleanup;
// freelines(argv_env); // freelines(argv_env);
// } // }
if (!setOptions(argc, (char **)argv, &widthbak, &prefixbak, &suffixbak, &hangbak, &lastbak, &minbak)) int option_code = setOptions(argc, (char **)argv, &widthbak, &prefixbak, &suffixbak, &hangbak, &lastbak, &minbak);
if (option_code == 0 || option_code==2)
goto parcleanup; goto parcleanup;
// printf("width: %d, prefix: %d, suffix: %d, hang: %d, last: %d, min: %d", widthbak, prefixbak, suffixbak, hangbak, lastbak, minbak); // printf("width: %d, prefix: %d, suffix: %d, hang: %d, last: %d, min: %d", widthbak, prefixbak, suffixbak, hangbak, lastbak, minbak);
@ -603,6 +604,11 @@ parcleanup:
{ {
report_error(stderr); report_error(stderr);
clear_error(); clear_error();
if (option_code == 2)
{
return EXIT_SUCCESS;
}
return (EXIT_FAILURE); return (EXIT_FAILURE);
} }