comparison tools/gfxconv.c @ 2515:a40de347fcb0

Make c64 formats listing (optionally) more verbose. Handle --help a bit differently in gfxconv.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 May 2020 20:06:24 +0300
parents e1a71d9eaede
children 5fcc9f7b8ad8
comparison
equal deleted inserted replaced
2514:bf1d671fc999 2515:a40de347fcb0
130 optOutType = FFMT_AUTO, 130 optOutType = FFMT_AUTO,
131 optInFormat = -1, 131 optInFormat = -1,
132 optOutFormat = -1, 132 optOutFormat = -1,
133 optItemCount = -1, 133 optItemCount = -1,
134 optPlanedWidth = 1, 134 optPlanedWidth = 1,
135 optForcedInSubFormat = -1; 135 optForcedInSubFormat = -1,
136 optShowHelp = 0;
137
136 unsigned int optInSkip = 0; 138 unsigned int optInSkip = 0;
137 BOOL optInSkipNeg = FALSE; 139 BOOL optInSkipNeg = FALSE;
138 140
139 int optCropMode = CROP_NONE, 141 int optCropMode = CROP_NONE,
140 optCropX0, optCropY0, 142 optCropX0, optCropY0,
231 printf( 233 printf(
232 "\n" 234 "\n"
233 "(Not all input->output combinations are actually supported.)\n" 235 "(Not all input->output combinations are actually supported.)\n"
234 "\n" 236 "\n"
235 ); 237 );
236
237 argShowC64Formats(stdout, TRUE);
238 } 238 }
239 239
240 240
241 void argShowHelp(void) 241 void argShowHelp(void)
242 { 242 {
761 char *tmpStr; 761 char *tmpStr;
762 762
763 switch (optN) 763 switch (optN)
764 { 764 {
765 case 0: 765 case 0:
766 argShowHelp(); 766 optShowHelp = 1;
767 exit(0);
768 break; 767 break;
769 768
770 case 3: 769 case 3:
771 argShowHelp(); 770 optShowHelp = 2;
772 argShowFormats();
773 argShowC64PaletteHelp(stdout);
774
775 for (int n = 0; n < optListN; n++)
776 {
777 const char *str = argGetHelpTopic(optList[n].id);
778 if (str != NULL)
779 fprintf(stdout, "\n%s\n", str);
780 }
781 exit(0);
782 break; 771 break;
783 772
784 case 1: 773 case 1:
785 dmPrintLicense(stdout); 774 dmPrintLicense(stdout);
786 exit(0); 775 exit(0);
835 } 824 }
836 } 825 }
837 break; 826 break;
838 827
839 case 18: 828 case 18:
840 argShowFormats(); 829 optShowHelp = 3;
841 exit(0);
842 break; 830 break;
843 831
844 case 20: 832 case 20:
845 optSequential = TRUE; 833 optSequential = TRUE;
846 break; 834 break;
2633 2621
2634 if (!dmArgsProcess(argc, argv, optList, optListN, 2622 if (!dmArgsProcess(argc, argv, optList, optListN,
2635 argHandleOpt, argHandleFile, OPTH_BAILOUT)) 2623 argHandleOpt, argHandleFile, OPTH_BAILOUT))
2636 exit(1); 2624 exit(1);
2637 2625
2626 switch (optShowHelp)
2627 {
2628 case 1:
2629 argShowHelp();
2630 exit(0);
2631 break;
2632
2633 case 2:
2634 argShowHelp();
2635 argShowFormats();
2636 argShowC64Formats(stdout, TRUE, TRUE);
2637 argShowC64PaletteHelp(stdout);
2638
2639 for (int n = 0; n < optListN; n++)
2640 {
2641 const char *str = argGetHelpTopic(optList[n].id);
2642 if (str != NULL)
2643 fprintf(stdout, "\n%s\n", str);
2644 }
2645 exit(0);
2646 break;
2647
2648 case 3:
2649 argShowFormats();
2650 argShowC64Formats(stdout, TRUE, dmVerbosity > 0);
2651 exit(0);
2652 break;
2653 }
2654
2638 // Determine input format, if not specified 2655 // Determine input format, if not specified
2639 if (optInType == FFMT_AUTO && optInFilename != NULL) 2656 if (optInType == FFMT_AUTO && optInFilename != NULL)
2640 { 2657 {
2641 char *dext = strrchr(optInFilename, '.'); 2658 char *dext = strrchr(optInFilename, '.');
2642 if (dext) 2659 if (dext)