cjpeg/djpeg/jpegtran: Restore jpeg-6b arg abbrevs
There are two approaches to handling abbreviated command-line options: 1. If a new option is introduced that begins with the same letters as an existing option, require a longer abbreviation for the existing option in order to ensure that abbreviations are always unique. 2. Require a unique abbreviation only for new options, and match all non-unique abbreviations with existing options, thus maintaining backward compatibility. keymatch() supports either approach, and Tom Lane historically seemed to prefer Approach 2, whereas both approaches have been applied inconsistently in the years since. This commit consistently applies Approach 2. More specific notes: We unnecessarily required 'cjpeg -progressive' to be abbreviated as 'cjpeg -pro' rather than 'cjpeg -p' when the -precision option was introduced in libjpeg-turbo 3.0 beta. The IJG unnecessarily required 'cjpeg -scans' to be abbreviated as 'cjpeg -scan' rather than 'cjpeg -sc' when the -scale option was introduced in jpeg-7. We even more unnecessarily adopted that requirement, even though we never adopted the -scale option. We unnecessarily required 'djpeg -scale' to be abbreviated as 'djpeg -sc' rather than 'djpeg -s' when the -skip option was introduced in libjpeg-turbo 1.5 beta. The IJG unnecessarily required 'jpegtran -copy' to be abbreviated as 'jpegtran -co' rather than 'jpegtran -c' when the -crop option was introduced in jpeg-7. The IJG unnecessarily required 'jpegtran -progressive' to be abbreviated as 'jpegtran -pr' rather than 'jpegtran -p' when the -perfect option was introduced in jpeg-7.
This commit is contained in:
4
cjpeg.c
4
cjpeg.c
@@ -456,7 +456,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
usage();
|
usage();
|
||||||
cinfo->data_precision = val;
|
cinfo->data_precision = val;
|
||||||
|
|
||||||
} else if (keymatch(arg, "progressive", 3)) {
|
} else if (keymatch(arg, "progressive", 1)) {
|
||||||
/* Select simple progressive mode. */
|
/* Select simple progressive mode. */
|
||||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||||
simple_progressive = TRUE;
|
simple_progressive = TRUE;
|
||||||
@@ -526,7 +526,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
* default sampling factors.
|
* default sampling factors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} else if (keymatch(arg, "scans", 4)) {
|
} else if (keymatch(arg, "scans", 2)) {
|
||||||
/* Set scan script. */
|
/* Set scan script. */
|
||||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||||
if (++argn >= argc) /* advance to next argument */
|
if (++argn >= argc) /* advance to next argument */
|
||||||
|
|||||||
2
djpeg.c
2
djpeg.c
@@ -392,7 +392,7 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv,
|
|||||||
} else if (keymatch(arg, "report", 2)) {
|
} else if (keymatch(arg, "report", 2)) {
|
||||||
report = TRUE;
|
report = TRUE;
|
||||||
|
|
||||||
} else if (keymatch(arg, "scale", 2)) {
|
} else if (keymatch(arg, "scale", 1)) {
|
||||||
/* Scale the output image by a fraction M/N. */
|
/* Scale the output image by a fraction M/N. */
|
||||||
if (++argn >= argc) /* advance to next argument */
|
if (++argn >= argc) /* advance to next argument */
|
||||||
usage();
|
usage();
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if (keymatch(arg, "copy", 2)) {
|
} else if (keymatch(arg, "copy", 1)) {
|
||||||
/* Select which extra markers to copy. */
|
/* Select which extra markers to copy. */
|
||||||
if (++argn >= argc) /* advance to next argument */
|
if (++argn >= argc) /* advance to next argument */
|
||||||
usage();
|
usage();
|
||||||
@@ -320,7 +320,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
* handle. */
|
* handle. */
|
||||||
transformoption.perfect = TRUE;
|
transformoption.perfect = TRUE;
|
||||||
|
|
||||||
} else if (keymatch(arg, "progressive", 2)) {
|
} else if (keymatch(arg, "progressive", 1)) {
|
||||||
/* Select simple progressive mode. */
|
/* Select simple progressive mode. */
|
||||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||||
simple_progressive = TRUE;
|
simple_progressive = TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user