@@ -185,7 +185,7 @@ static void cleanup(int code) {
185
185
186
186
/* Print usage information */
187
187
static void printUsage (void ) {
188
- fprintf (stderr ,
188
+ fprintf (stdout ,
189
189
"Usage:\n"
190
190
" %s [options] <srcfile> [<dstfile>]\n"
191
191
"OR: %s -X <scriptfile>\n\n"
@@ -209,63 +209,62 @@ static void printUsage(void) {
209
209
/* Show usage information */
210
210
static void showUsage (void ) {
211
211
printUsage ();
212
- quit (0 );
213
212
}
214
213
215
214
/* Show usage and help information */
216
215
static void showHelp (void ) {
217
216
printUsage ();
218
- fprintf (stderr ,
217
+ fprintf (stdout ,
219
218
"Notes:\n"
220
219
" This program supports table-editing, listing, and checksumming options\n"
221
220
"on sfnt-formatted files such as OpenType Format (OTF) or TrueType. The\n"
222
221
"mandatory source file is specified as an argument to the program. An\n"
223
222
"optional destination file may also be specified which receives the edited\n"
224
223
"data otherwise the source data is edited in-place thus modifying the source\n" );
225
- fprintf (stderr ,
224
+ fprintf (stdout ,
226
225
"file. In-place editing is achieved by the use of a temporary file called\n"
227
226
"%s that is created in the directory of execution (requiring you\n"
228
227
"to have write permission to that directory).\n"
229
228
" The target table of an editing option (-x, -d, and -a) is specified\n"
230
229
"with a table tag argument that is nominally 4 characters long. If fewer\n"
231
230
"than 4 characters are specified the tag is padded with spaces (more than 4\n" ,
232
231
tmpname );
233
- fprintf (stderr ,
232
+ fprintf (stdout ,
234
233
"characters is a fatal error). Multiple tables may be specified as a single\n"
235
234
"argument composed from a comma-separated list of tags.\n"
236
235
" The extract option (-x) copies the table data into a file whose default\n"
237
236
"name is the concatenation of the source filename (less its .otf or .ttf\n"
238
237
"extension), a period character (.), and the table tag. If the tag contains\n"
239
238
"non-alphanumeric characters they are replaced by underscore characters (_)\n" );
240
- fprintf (stderr ,
239
+ fprintf (stdout ,
241
240
"and finally trailing underscores are removed. The default filename may be\n"
242
241
"overridden by appending an equals character (=) followed by an alternate\n"
243
242
"filename to the table tag argument. The delete option (-d) deletes a table.\n"
244
243
"Unlike the -x option no files may be specified in the table tag list. The\n"
245
244
"add option (-a) adds a table or replaces one if the table already exists.\n"
246
245
"The source file containing the table data is specified by appending an\n" );
247
- fprintf (stderr ,
246
+ fprintf (stdout ,
248
247
"equals character (=) followed by a filename to the table tag.\n"
249
248
" The 3 editing options may be specified together as acting on the same\n"
250
249
"table. In such cases the -x option is applied before the -d option which is\n"
251
250
"applied before the -a option. (The -d option applied to the same table as a\n"
252
251
"subsequent -a option is permitted but redundant.) The -d and -a options\n"
253
252
"change the contents of the sfnt and cause the table checksums and the head\n" );
254
- fprintf (stderr ,
253
+ fprintf (stdout ,
255
254
"table's checksum adjustment field to be recomputed.\n"
256
255
" The list option (-l) simply lists the contents of the sfnt table\n"
257
256
"directory. This is the default action if no other options are specified.\n"
258
257
"The check checksum option (-c) performs a check of all the table checksums\n"
259
258
"and the head table's checksum adjustment field and reports any errors. The\n"
260
259
"fix checksum option (-f) fixes any checksum errors.\n" );
261
- fprintf (stderr ,
260
+ fprintf (stdout ,
262
261
" The -d, -a, and -f options create a new sfnt file by copying tables\n"
263
262
"from the source file to the destination file. The tables are copied in the\n"
264
263
"order recommended in the OpenType specification. A side effect of copying\n"
265
264
"is that all table information including checksums and sfnt search fields\n"
266
265
"is recalculated.\n"
267
266
"Examples:\n" );
268
- fprintf (stderr ,
267
+ fprintf (stdout ,
269
268
"o Extract GPOS and GSUB tables to files minion.GPOS and minion.GSUB.\n"
270
269
" sfntedit -x GPOS,GSUB minion.otf\n"
271
270
"o Add tables extracted previously to different font.\n"
@@ -274,7 +273,6 @@ static void showHelp(void) {
274
273
" sfntedit -d TR01,TR02,TR03 pala.ttf\n"
275
274
"o Copy font to new file fixing checksums and reordering tables.\n"
276
275
" sfntedit -f helv.ttf newhelv.ttf\n" );
277
- quit (0 );
278
276
}
279
277
280
278
static void makeArgs (char * filename ) {
@@ -525,10 +523,10 @@ static int parseArgs(int argc, char *argv[]) {
525
523
break ;
526
524
case 'u' :
527
525
showUsage ();
528
- break ;
526
+ exit ( 0 ) ;
529
527
case 'h' :
530
528
showHelp ();
531
- break ;
529
+ exit ( 0 ) ;
532
530
default :
533
531
fatal (SFED_MSG_UNRECOGOPT , arg );
534
532
}
@@ -635,21 +633,21 @@ static void sfntReadHdr(void) {
635
633
static void sfntDumpHdr (void ) {
636
634
int i ;
637
635
638
- fprintf (stderr , "--- sfnt header [%s]\n" , srcfile .name );
636
+ fprintf (stdout , "--- sfnt header [%s]\n" , srcfile .name );
639
637
if (sfnt .version == 0x00010000 )
640
- fprintf (stderr , "version =1.0 (00010000)\n" );
638
+ fprintf (stdout , "version =1.0 (00010000)\n" );
641
639
else
642
- fprintf (stderr , "version =%c%c%c%c (%08x)\n" ,
640
+ fprintf (stdout , "version =%c%c%c%c (%08x)\n" ,
643
641
TAG_ARG (sfnt .version ), sfnt .version );
644
- fprintf (stderr , "numTables =%hu\n" , sfnt .numTables );
645
- fprintf (stderr , "searchRange =%hu\n" , sfnt .searchRange );
646
- fprintf (stderr , "entrySelector=%hu\n" , sfnt .entrySelector );
647
- fprintf (stderr , "rangeShift =%hu\n" , sfnt .rangeShift );
642
+ fprintf (stdout , "numTables =%hu\n" , sfnt .numTables );
643
+ fprintf (stdout , "searchRange =%hu\n" , sfnt .searchRange );
644
+ fprintf (stdout , "entrySelector=%hu\n" , sfnt .entrySelector );
645
+ fprintf (stdout , "rangeShift =%hu\n" , sfnt .rangeShift );
648
646
649
- fprintf (stderr , "--- table directory [index]={tag,checksum,offset,length}\n" );
647
+ fprintf (stdout , "--- table directory [index]={tag,checksum,offset,length}\n" );
650
648
for (i = 0 ; i < sfnt .numTables ; i ++ ) {
651
649
Table * tbl = & sfnt .directory [i ];
652
- fprintf (stderr , "[%2d]={%c%c%c%c,%08x,%08x,%08x}\n" , i ,
650
+ fprintf (stdout , "[%2d]={%c%c%c%c,%08x,%08x,%08x}\n" , i ,
653
651
TAG_ARG (tbl -> tag ), tbl -> checksum , tbl -> offset , tbl -> length );
654
652
}
655
653
}
@@ -1245,7 +1243,5 @@ int main(int argc, char *argv[]) {
1245
1243
1246
1244
doingScripting = 0 ;
1247
1245
}
1248
-
1249
- fprintf (stdout , "\nDone.\n" );
1250
1246
return 0 ;
1251
1247
}
0 commit comments