static void display_full_usage() { /* Usage */ fprintf(stderr, "floptool - Generic floppy image manipulation tool for use with MESS\n\n"); display_usage(); fprintf(stderr, "\n"); display_formats(); fprintf(stderr, "\nExample usage:\n"); fprintf(stderr, " floptool.exe identify image.dsk\n\n"); }
int CLIB_DECL main(int argc, char *argv[]) { int i; int found =0; const struct CassetteFormat * const *selected_formats = NULL; cassette_image *cassette; FILE *f; if (argc > 1) { if (!core_stricmp("convert", argv[1])) { // convert command if (argc!=5) { fprintf(stderr, "Wrong parameter number.\n\n"); display_usage(); return -1; } else { for (i = 0; formats[i].name; i++) { if (core_stricmp(formats[i].name,argv[2])==0) { selected_formats = formats[i].formats; found = 1; } } if (found==0) { fprintf(stderr, "Wrong format name.\n\n"); display_usage(); fprintf(stderr, "\n"); display_formats(); return -1; } f = fopen(argv[3], "rb"); if (!f) { fprintf(stderr, "File %s not found.\n",argv[3]); return -1; } if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette)) { fprintf(stderr, "Invalid format of input file.\n"); fclose(f); return -1; } cassette_dump(cassette,argv[4]); cassette_close(cassette); fclose(f); goto theend; } } } /* Usage */ fprintf(stderr, "castool - Generic cassette manipulation tool for use with MESS\n\n"); display_usage(); fprintf(stderr, "\n"); display_formats(); fprintf(stderr, "\nExample usage:\n"); fprintf(stderr, " castool.exe convert tzx game.tzx game.wav\n\n"); theend : return 0; }