4 * Copyright (C) 1995-2001, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
8 * This file contains a command-line user interface for JPEG transcoding.
9 * It is very similar to cjpeg.c, but provides lossless transcoding between
10 * different JPEG file formats. It also provides some lossless and sort-of-
11 * lossless transformations of JPEG data.
14 #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
15 #include "transupp.h" /* Support routines for jpegtran */
16 #include "jversion.h" /* for version message */
18 #ifdef USE_CCOMMAND /* command-line reader for Macintosh */
20 #include <SIOUX.h> /* Metrowerks needs this */
21 #include <console.h> /* ... and this */
24 #include <console.h> /* Think declares it here */
30 * Argument-parsing code.
31 * The switch parser is designed to be useful with DOS-style command line
32 * syntax, ie, intermixed switches and file names, where only the switches
33 * to the left of a given file name affect processing of that file.
34 * The main program in this file doesn't actually use this capability...
38 static const char * progname
; /* program name for error messages */
39 static char * outfilename
; /* for -outfile switch */
40 static char * dropfilename
; /* for -drop switch */
41 static JCOPY_OPTION copyoption
; /* -copy switch */
42 static jpeg_transform_info transformoption
; /* image transformation options */
47 /* complain about bad command line */
49 fprintf(stderr
, "usage: %s [switches] ", progname
);
50 #ifdef TWO_FILE_COMMANDLINE
51 fprintf(stderr
, "inputfile outputfile\n");
53 fprintf(stderr
, "[inputfile]\n");
56 fprintf(stderr
, "Switches (names may be abbreviated):\n");
57 fprintf(stderr
, " -copy none Copy no extra markers from source file\n");
58 fprintf(stderr
, " -copy comments Copy only comment markers (default)\n");
59 fprintf(stderr
, " -copy all Copy all extra markers\n");
60 fprintf(stderr
, " -copy exif Copy EXIF marker and omit JFIF if EXIF\n");
61 #ifdef ENTROPY_OPT_SUPPORTED
62 fprintf(stderr
, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
64 #ifdef C_PROGRESSIVE_SUPPORTED
65 fprintf(stderr
, " -progressive Create progressive JPEG file\n");
67 #if TRANSFORMS_SUPPORTED
68 fprintf(stderr
, "Switches for modifying the image:\n");
69 fprintf(stderr
, " -crop WxH+X+Y Crop to a rectangular subarea\n");
70 fprintf(stderr
, " -drop +X+Y filename Drop another image\n");
71 fprintf(stderr
, " -grayscale Reduce to grayscale (omit color data)\n");
72 fprintf(stderr
, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n");
73 fprintf(stderr
, " -perfect Fail if there is non-transformable edge blocks\n");
74 fprintf(stderr
, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
75 fprintf(stderr
, " -transpose Transpose image\n");
76 fprintf(stderr
, " -transverse Transverse transpose image\n");
77 fprintf(stderr
, " -trim Drop non-transformable edge blocks or\n");
78 fprintf(stderr
, " with -drop: Requantize drop file to source file\n");
79 #endif /* TRANSFORMS_SUPPORTED */
80 fprintf(stderr
, "Switches for advanced users:\n");
81 fprintf(stderr
, " -restart N Set restart interval in rows, or in blocks with B\n");
82 fprintf(stderr
, " -maxmemory N Maximum memory to use (in kbytes)\n");
83 fprintf(stderr
, " -outfile name Specify name for output file\n");
84 fprintf(stderr
, " -verbose or -debug Emit debug output\n");
85 fprintf(stderr
, "Switches for wizards:\n");
86 #ifdef C_ARITH_CODING_SUPPORTED
87 fprintf(stderr
, " -arithmetic Use arithmetic coding\n");
89 #ifdef C_MULTISCAN_FILES_SUPPORTED
90 fprintf(stderr
, " -scans file Create multi-scan JPEG per script file\n");
97 select_transform (JXFORM_CODE transform
)
98 /* Silly little routine to detect multiple transform options,
99 * which we can't handle.
102 #if TRANSFORMS_SUPPORTED
103 if (transformoption
.transform
== JXFORM_NONE
||
104 transformoption
.transform
== transform
) {
105 transformoption
.transform
= transform
;
107 fprintf(stderr
, "%s: can only do one image transformation at a time\n",
112 fprintf(stderr
, "%s: sorry, image transformation was not compiled\n",
119 handle_exif (j_decompress_ptr srcinfo
, j_compress_ptr dstinfo
,
120 JCOPY_OPTION
*copyoption
)
121 /* Adjust the marker writing options to create an EXIF file, instead of JFIF,
122 * if so requested or an EXIF file is detected as input. Must be called after
123 * jpeg_copy_critical_parameters() as that sets the defaults. */
125 jpeg_saved_marker_ptr cur_marker
, prev_marker
;
127 /* Look for an exif marker */
129 cur_marker
= srcinfo
->marker_list
;
130 while (cur_marker
!= NULL
) {
131 if (cur_marker
->marker
== JPEG_APP0
+1 &&
132 cur_marker
->data_length
>= 6 &&
133 GETJOCTET(cur_marker
->data
[0]) == 0x45 &&
134 GETJOCTET(cur_marker
->data
[1]) == 0x78 &&
135 GETJOCTET(cur_marker
->data
[2]) == 0x69 &&
136 GETJOCTET(cur_marker
->data
[3]) == 0x66 &&
137 GETJOCTET(cur_marker
->data
[4]) == 0 &&
138 GETJOCTET(cur_marker
->data
[5]) == 0)
139 break; /* found an EXIF marker */
140 prev_marker
= cur_marker
;
141 cur_marker
= cur_marker
->next
;
143 /* If we've found an EXIF marker but not JFIF this is an EXIF file. Unless
144 * explicitely requested, make sure we keep the EXIF marker and do not
145 * emit a JFIF marker (which would come before). EXIF requires that the
146 * first marker be EXIF. */
147 if (cur_marker
!= NULL
&&
148 ((*copyoption
!= JCOPYOPT_NONE
&& !srcinfo
->saw_JFIF_marker
) ||
149 (*copyoption
== JCOPYOPT_EXIF
))) {
150 dstinfo
->write_JFIF_header
= FALSE
;
151 if (*copyoption
== JCOPYOPT_COMMENTS
)
152 *copyoption
= JCOPYOPT_EXIF
;
154 /* If making an EXIF file, make sure that EXIF is first marker */
155 if (cur_marker
!= NULL
&& prev_marker
!= NULL
&&
156 *copyoption
== JCOPYOPT_EXIF
) {
157 prev_marker
->next
= cur_marker
->next
;
158 cur_marker
->next
= srcinfo
->marker_list
;
159 srcinfo
->marker_list
= cur_marker
;
164 parse_switches (j_compress_ptr cinfo
, int argc
, char **argv
,
165 int last_file_arg_seen
, boolean for_real
)
166 /* Parse optional switches.
167 * Returns argv[] index of first file-name argument (== argc if none).
168 * Any file names with indexes <= last_file_arg_seen are ignored;
169 * they have presumably been processed in a previous iteration.
170 * (Pass 0 for last_file_arg_seen on the first or only iteration.)
171 * for_real is FALSE on the first (dummy) pass; we may skip any expensive
177 boolean simple_progressive
;
178 char * scansarg
= NULL
; /* saves -scans parm if any */
180 /* Set up default JPEG parameters. */
181 simple_progressive
= FALSE
;
184 copyoption
= JCOPYOPT_DEFAULT
;
185 transformoption
.transform
= JXFORM_NONE
;
186 transformoption
.trim
= FALSE
;
187 transformoption
.perfect
= FALSE
;
188 transformoption
.force_grayscale
= FALSE
;
189 transformoption
.crop
= FALSE
;
190 cinfo
->err
->trace_level
= 0;
192 /* Scan command line options, adjust parameters */
194 for (argn
= 1; argn
< argc
; argn
++) {
197 /* Not a switch, must be a file name argument */
198 if (argn
<= last_file_arg_seen
) {
199 outfilename
= NULL
; /* -outfile applies to just one input file */
200 continue; /* ignore this name if previously processed */
202 break; /* else done parsing switches */
204 arg
++; /* advance past switch marker character */
206 if (keymatch(arg
, "arithmetic", 1)) {
207 /* Use arithmetic coding. */
208 #ifdef C_ARITH_CODING_SUPPORTED
209 cinfo
->arith_code
= TRUE
;
211 fprintf(stderr
, "%s: sorry, arithmetic coding not supported\n",
216 } else if (keymatch(arg
, "copy", 2)) {
217 /* Select which extra markers to copy. */
218 if (++argn
>= argc
) /* advance to next argument */
220 if (keymatch(argv
[argn
], "none", 1)) {
221 copyoption
= JCOPYOPT_NONE
;
222 } else if (keymatch(argv
[argn
], "comments", 1)) {
223 copyoption
= JCOPYOPT_COMMENTS
;
224 } else if (keymatch(argv
[argn
], "all", 1)) {
225 copyoption
= JCOPYOPT_ALL
;
226 } else if (keymatch(argv
[argn
], "exif", 1)) {
227 copyoption
= JCOPYOPT_EXIF
;
231 } else if (keymatch(arg
, "crop", 2)) {
232 /* Perform lossless cropping. */
233 #if TRANSFORMS_SUPPORTED
234 if (++argn
>= argc
) /* advance to next argument */
236 if (transformoption
.crop
/* reject multiple crop/drop requests */ ||
237 ! jtransform_parse_crop_spec(&transformoption
, argv
[argn
])) {
238 fprintf(stderr
, "%s: bogus -crop argument '%s'\n",
239 progname
, argv
[argn
]);
243 select_transform(JXFORM_NONE
); /* force an error */
246 } else if (keymatch(arg
, "drop", 2)) {
247 #if TRANSFORMS_SUPPORTED
248 if (++argn
>= argc
) /* advance to next argument */
250 if (transformoption
.crop
/* reject multiple crop/drop requests */ ||
251 ! jtransform_parse_crop_spec(&transformoption
, argv
[argn
]) ||
252 transformoption
.crop_width_set
!= JCROP_UNSET
||
253 transformoption
.crop_height_set
!= JCROP_UNSET
) {
254 fprintf(stderr
, "%s: bogus -drop argument '%s'\n",
255 progname
, argv
[argn
]);
258 if (++argn
>= argc
) /* advance to next argument */
260 dropfilename
= argv
[argn
];
261 select_transform(JXFORM_DROP
);
263 select_transform(JXFORM_NONE
); /* force an error */
267 } else if (keymatch(arg
, "debug", 1) || keymatch(arg
, "verbose", 1)) {
268 /* Enable debug printouts. */
269 /* On first -d, print version identification */
270 static boolean printed_version
= FALSE
;
272 if (! printed_version
) {
273 fprintf(stderr
, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n",
274 JVERSION
, JCOPYRIGHT
);
275 fprintf(stderr
, "EXIF support v 0.1 added 29-Sep-2003\n");
276 printed_version
= TRUE
;
278 cinfo
->err
->trace_level
++;
280 } else if (keymatch(arg
, "flip", 1)) {
281 /* Mirror left-right or top-bottom. */
282 if (++argn
>= argc
) /* advance to next argument */
284 if (keymatch(argv
[argn
], "horizontal", 1))
285 select_transform(JXFORM_FLIP_H
);
286 else if (keymatch(argv
[argn
], "vertical", 1))
287 select_transform(JXFORM_FLIP_V
);
291 } else if (keymatch(arg
, "grayscale", 1) || keymatch(arg
, "greyscale",1)) {
292 /* Force to grayscale. */
293 #if TRANSFORMS_SUPPORTED
294 transformoption
.force_grayscale
= TRUE
;
296 select_transform(JXFORM_NONE
); /* force an error */
299 } else if (keymatch(arg
, "maxmemory", 3)) {
300 /* Maximum memory in Kb (or Mb with 'm'). */
304 if (++argn
>= argc
) /* advance to next argument */
306 if (sscanf(argv
[argn
], "%ld%c", &lval
, &ch
) < 1)
308 if (ch
== 'm' || ch
== 'M')
310 cinfo
->mem
->max_memory_to_use
= lval
* 1000L;
312 } else if (keymatch(arg
, "optimize", 1) || keymatch(arg
, "optimise", 1)) {
313 /* Enable entropy parm optimization. */
314 #ifdef ENTROPY_OPT_SUPPORTED
315 cinfo
->optimize_coding
= TRUE
;
317 fprintf(stderr
, "%s: sorry, entropy optimization was not compiled\n",
322 } else if (keymatch(arg
, "outfile", 4)) {
323 /* Set output file name. */
324 if (++argn
>= argc
) /* advance to next argument */
326 outfilename
= argv
[argn
]; /* save it away for later use */
328 } else if (keymatch(arg
, "perfect", 2)) {
329 /* Fail if there is any partial edge MCUs that the transform can't
331 transformoption
.perfect
= TRUE
;
333 } else if (keymatch(arg
, "progressive", 2)) {
334 /* Select simple progressive mode. */
335 #ifdef C_PROGRESSIVE_SUPPORTED
336 simple_progressive
= TRUE
;
337 /* We must postpone execution until num_components is known. */
339 fprintf(stderr
, "%s: sorry, progressive output was not compiled\n",
344 } else if (keymatch(arg
, "restart", 1)) {
345 /* Restart interval in MCU rows (or in MCUs with 'b'). */
349 if (++argn
>= argc
) /* advance to next argument */
351 if (sscanf(argv
[argn
], "%ld%c", &lval
, &ch
) < 1)
353 if (lval
< 0 || lval
> 65535L)
355 if (ch
== 'b' || ch
== 'B') {
356 cinfo
->restart_interval
= (unsigned int) lval
;
357 cinfo
->restart_in_rows
= 0; /* else prior '-restart n' overrides me */
359 cinfo
->restart_in_rows
= (int) lval
;
360 /* restart_interval will be computed during startup */
363 } else if (keymatch(arg
, "rotate", 2)) {
364 /* Rotate 90, 180, or 270 degrees (measured clockwise). */
365 if (++argn
>= argc
) /* advance to next argument */
367 if (keymatch(argv
[argn
], "90", 2))
368 select_transform(JXFORM_ROT_90
);
369 else if (keymatch(argv
[argn
], "180", 3))
370 select_transform(JXFORM_ROT_180
);
371 else if (keymatch(argv
[argn
], "270", 3))
372 select_transform(JXFORM_ROT_270
);
376 } else if (keymatch(arg
, "scans", 1)) {
377 /* Set scan script. */
378 #ifdef C_MULTISCAN_FILES_SUPPORTED
379 if (++argn
>= argc
) /* advance to next argument */
381 scansarg
= argv
[argn
];
382 /* We must postpone reading the file in case -progressive appears. */
384 fprintf(stderr
, "%s: sorry, multi-scan output was not compiled\n",
389 } else if (keymatch(arg
, "transpose", 1)) {
390 /* Transpose (across UL-to-LR axis). */
391 select_transform(JXFORM_TRANSPOSE
);
393 } else if (keymatch(arg
, "transverse", 6)) {
394 /* Transverse transpose (across UR-to-LL axis). */
395 select_transform(JXFORM_TRANSVERSE
);
397 } else if (keymatch(arg
, "trim", 3)) {
398 /* Trim off any partial edge MCUs that the transform can't handle. */
399 transformoption
.trim
= TRUE
;
402 usage(); /* bogus switch */
406 /* Post-switch-scanning cleanup */
410 #ifdef C_PROGRESSIVE_SUPPORTED
411 if (simple_progressive
) /* process -progressive; -scans can override */
412 jpeg_simple_progression(cinfo
);
415 #ifdef C_MULTISCAN_FILES_SUPPORTED
416 if (scansarg
!= NULL
) /* process -scans if it was present */
417 if (! read_scan_script(cinfo
, scansarg
))
422 return argn
; /* return index of next arg (file name) */
431 main (int argc
, char **argv
)
433 struct jpeg_decompress_struct srcinfo
;
434 struct jpeg_error_mgr jsrcerr
;
435 #if TRANSFORMS_SUPPORTED
436 struct jpeg_decompress_struct dropinfo
;
437 struct jpeg_error_mgr jdroperr
;
440 struct jpeg_compress_struct dstinfo
;
441 struct jpeg_error_mgr jdsterr
;
442 #ifdef PROGRESS_REPORT
443 struct cdjpeg_progress_mgr progress
;
445 jvirt_barray_ptr
* src_coef_arrays
;
446 jvirt_barray_ptr
* dst_coef_arrays
;
448 /* We assume all-in-memory processing and can therefore use only a
449 * single file pointer for sequential input and output operation.
453 /* On Mac, fetch a command line. */
455 argc
= ccommand(&argv
);
459 if (progname
== NULL
|| progname
[0] == 0)
460 progname
= "jpegtran"; /* in case C library doesn't provide it */
462 /* Initialize the JPEG decompression object with default error handling. */
463 srcinfo
.err
= jpeg_std_error(&jsrcerr
);
464 jpeg_create_decompress(&srcinfo
);
465 /* Initialize the JPEG compression object with default error handling. */
466 dstinfo
.err
= jpeg_std_error(&jdsterr
);
467 jpeg_create_compress(&dstinfo
);
469 /* Now safe to enable signal catcher.
470 * Note: we assume only the decompression object will have virtual arrays.
472 #ifdef NEED_SIGNAL_CATCHER
473 enable_signal_catcher((j_common_ptr
) &srcinfo
);
476 /* Scan command line to find file names.
477 * It is convenient to use just one switch-parsing routine, but the switch
478 * values read here are mostly ignored; we will rescan the switches after
479 * opening the input file. Also note that most of the switches affect the
480 * destination JPEG object, so we parse into that and then copy over what
481 * needs to affects the source too.
484 file_index
= parse_switches(&dstinfo
, argc
, argv
, 0, FALSE
);
485 jsrcerr
.trace_level
= jdsterr
.trace_level
;
486 srcinfo
.mem
->max_memory_to_use
= dstinfo
.mem
->max_memory_to_use
;
488 #ifdef TWO_FILE_COMMANDLINE
489 /* Must have either -outfile switch or explicit output file name */
490 if (outfilename
== NULL
) {
491 if (file_index
!= argc
-2) {
492 fprintf(stderr
, "%s: must name one input and one output file\n",
496 outfilename
= argv
[file_index
+1];
498 if (file_index
!= argc
-1) {
499 fprintf(stderr
, "%s: must name one input and one output file\n",
505 /* Unix style: expect zero or one file name */
506 if (file_index
< argc
-1) {
507 fprintf(stderr
, "%s: only one input file\n", progname
);
510 #endif /* TWO_FILE_COMMANDLINE */
512 /* Open the input file. */
513 if (file_index
< argc
) {
514 if ((fp
= fopen(argv
[file_index
], READ_BINARY
)) == NULL
) {
515 fprintf(stderr
, "%s: can't open %s for reading\n", progname
, argv
[file_index
]);
519 /* default input file is stdin */
522 #if TRANSFORMS_SUPPORTED
523 /* Open the drop file. */
524 if (dropfilename
!= NULL
) {
525 if ((drop_file
= fopen(dropfilename
, READ_BINARY
)) == NULL
) {
526 fprintf(stderr
, "%s: can't open %s for reading\n", progname
, dropfilename
);
529 dropinfo
.err
= jpeg_std_error(&jdroperr
);
530 jpeg_create_decompress(&dropinfo
);
531 jpeg_stdio_src(&dropinfo
, drop_file
);
538 #ifdef PROGRESS_REPORT
539 start_progress_monitor((j_common_ptr
) &dstinfo
, &progress
);
542 /* Specify data source for decompression */
543 jpeg_stdio_src(&srcinfo
, fp
);
545 /* Enable saving of extra markers that we want to copy */
546 jcopy_markers_setup(&srcinfo
, copyoption
);
548 /* Read file header */
549 (void) jpeg_read_header(&srcinfo
, TRUE
);
551 #if TRANSFORMS_SUPPORTED
552 if (dropfilename
!= NULL
) {
553 (void) jpeg_read_header(&dropinfo
, TRUE
);
554 transformoption
.crop_width
= dropinfo
.image_width
;
555 transformoption
.crop_width_set
= JCROP_POS
;
556 transformoption
.crop_height
= dropinfo
.image_height
;
557 transformoption
.crop_height_set
= JCROP_POS
;
558 transformoption
.drop_ptr
= &dropinfo
;
562 /* Any space needed by a transform option must be requested before
563 * jpeg_read_coefficients so that memory allocation will be done right.
565 #if TRANSFORMS_SUPPORTED
566 /* Fails right away if -perfect is given and transformation is not perfect.
568 if (transformoption
.perfect
&&
569 !jtransform_perfect_transform(srcinfo
.image_width
, srcinfo
.image_height
,
570 srcinfo
.max_h_samp_factor
* DCTSIZE
, srcinfo
.max_v_samp_factor
* DCTSIZE
,
571 transformoption
.transform
)) {
572 fprintf(stderr
, "%s: transformation is not perfect\n", progname
);
575 jtransform_request_workspace(&srcinfo
, &transformoption
);
578 /* Read source file as DCT coefficients */
579 src_coef_arrays
= jpeg_read_coefficients(&srcinfo
);
581 #if TRANSFORMS_SUPPORTED
582 if (dropfilename
!= NULL
) {
583 transformoption
.drop_coef_arrays
= jpeg_read_coefficients(&dropinfo
);
587 /* Initialize destination compression parameters from source values */
588 jpeg_copy_critical_parameters(&srcinfo
, &dstinfo
);
591 /* Adjust destination parameters if required by transform options;
592 * also find out which set of coefficient arrays will hold the output.
594 #if TRANSFORMS_SUPPORTED
595 dst_coef_arrays
= jtransform_adjust_parameters(&srcinfo
, &dstinfo
,
599 dst_coef_arrays
= src_coef_arrays
;
602 /* Close input file, if we opened it.
603 * Note: we assume that jpeg_read_coefficients consumed all input
604 * until JPEG_REACHED_EOI, and that jpeg_finish_decompress will
605 * only consume more while (! cinfo->inputctl->eoi_reached).
606 * We cannot call jpeg_finish_decompress here since we still need the
607 * virtual arrays allocated from the source object for processing.
612 /* Open the output file. */
613 if (outfilename
!= NULL
) {
614 if ((fp
= fopen(outfilename
, WRITE_BINARY
)) == NULL
) {
615 fprintf(stderr
, "%s: can't open %s for writing\n", progname
, outfilename
);
619 /* default output file is stdout */
623 /* Adjust default compression parameters by re-parsing the options */
624 /* Save value of copyoption */
625 file_index
= parse_switches(&dstinfo
, argc
, argv
, 0, TRUE
);
627 /* If we want EXIF, make sure we do not write incompatible markers */
628 handle_exif(&srcinfo
,&dstinfo
,©option
);
630 /* Specify data destination for compression */
631 jpeg_stdio_dest(&dstinfo
, fp
);
633 /* Start compressor (note no image data is actually written here) */
634 jpeg_write_coefficients(&dstinfo
, dst_coef_arrays
);
636 /* Copy to the output file any extra markers that we want to preserve */
637 jcopy_markers_execute(&srcinfo
, &dstinfo
, copyoption
);
639 /* Execute image transformation, if any */
640 #if TRANSFORMS_SUPPORTED
641 jtransform_execute_transform(&srcinfo
, &dstinfo
,
646 /* Finish compression and release memory */
647 jpeg_finish_compress(&dstinfo
);
648 jpeg_destroy_compress(&dstinfo
);
649 #if TRANSFORMS_SUPPORTED
650 if (dropfilename
!= NULL
) {
651 (void) jpeg_finish_decompress(&dropinfo
);
652 jpeg_destroy_decompress(&dropinfo
);
655 (void) jpeg_finish_decompress(&srcinfo
);
656 jpeg_destroy_decompress(&srcinfo
);
658 /* Close output file, if we opened it */
661 #if TRANSFORMS_SUPPORTED
662 if (drop_file
!= NULL
)
666 #ifdef PROGRESS_REPORT
667 end_progress_monitor((j_common_ptr
) &dstinfo
);
671 #if TRANSFORMS_SUPPORTED
672 if (dropfilename
!= NULL
)
673 exit(jsrcerr
.num_warnings
+ jdroperr
.num_warnings
+ jdsterr
.num_warnings
?
674 EXIT_WARNING
: EXIT_SUCCESS
);
676 exit(jsrcerr
.num_warnings
+ jdsterr
.num_warnings
?EXIT_WARNING
:EXIT_SUCCESS
);
677 return 0; /* suppress no-return-value warnings */