shithub: rgbds

Download patch

ref: 2da63e2f7de34ee73368816d4af2304c8e77665d
parent: 0b647c5a253a77360e32042a0d93bd842da6027d
author: bentley <[email protected]>
date: Wed Jan 13 05:08:23 EST 2010

cosmetic change: rearrange getopt() switch for easier reading

cases are put in alphabetical order, to match the getopt string.

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -190,20 +190,30 @@
 
 	while ((ch = getopt(argc, argv, "Ccdjk:m:p:qr:st:v")) != -1) {
 		switch (ch) {
+		case 'c':
+			if (ulOptions & OPTF_GBCMODE) {
+				errx(EX_USAGE, "-c and -C can't be used together");
+			}
+			ulOptions |= OPTF_GBCMODE;
+			gbc_mode = 0xC0;
+			break;
+		case 'C':
+			if (ulOptions & OPTF_GBCMODE) {
+				errx(EX_USAGE, "-c and -C can't be used together");
+			}
+			ulOptions |= OPTF_GBCMODE;
+			gbc_mode = 0x80;
+			break;
 		case 'd':
 			ulOptions |= OPTF_DEBUG;
 			break;
-		case 'r':
-			ulOptions |= OPTF_RAMSIZE;
-			ram_size = strtoul(optarg, &ep, 0);
-			if (optarg[0] == '\0' || *ep != '\0')
-				errx(EX_USAGE, "Invalid argument for option 'r'");
-			if (ram_size < 0 || ram_size > 0xFF)
-				errx(EX_USAGE, "Argument for option 'r' must be between 0 and 0xFF");
-			break;
 		case 'j':
 			ulOptions |= OPTF_JAPAN;
 			break;
+		case 'k':
+			strncpy(nlicensee, optarg, 2);
+			ulOptions |= OPTF_NLICENSEE;
+			break;
 		case 'm':
 			ulOptions |= OPTF_MBCTYPE;
 			mbc_type = strtoul(optarg, &ep, 0);
@@ -220,36 +230,26 @@
 			if (pad_value < 0 || pad_value > 0xFF)
 				errx(EX_USAGE, "Argument for option 'p' must be between 0 and 0xFF");
 			break;
-		case 'v':
-			ulOptions |= OPTF_VALIDATE;
-			break;
-		case 't':
-			strncpy(cartname, optarg, 16);
-			ulOptions |= OPTF_TITLE;
-			break;
-		case 'k':
-			strncpy(nlicensee, optarg, 2);
-			ulOptions |= OPTF_NLICENSEE;
-			break;
 		case 'q':
 			ulOptions |= OPTF_QUIET;
 			break;
-		case 'c':
-			if (ulOptions & OPTF_GBCMODE) {
-				errx(EX_USAGE, "-c and -C can't be used together");
-			}
-			ulOptions |= OPTF_GBCMODE;
-			gbc_mode = 0xC0;
+		case 'r':
+			ulOptions |= OPTF_RAMSIZE;
+			ram_size = strtoul(optarg, &ep, 0);
+			if (optarg[0] == '\0' || *ep != '\0')
+				errx(EX_USAGE, "Invalid argument for option 'r'");
+			if (ram_size < 0 || ram_size > 0xFF)
+				errx(EX_USAGE, "Argument for option 'r' must be between 0 and 0xFF");
 			break;
-		case 'C':
-			if (ulOptions & OPTF_GBCMODE) {
-				errx(EX_USAGE, "-c and -C can't be used together");
-			}
-			ulOptions |= OPTF_GBCMODE;
-			gbc_mode = 0x80;
-			break;
 		case 's':
 			ulOptions |= OPTF_SGBMODE;
+			break;
+		case 't':
+			strncpy(cartname, optarg, 16);
+			ulOptions |= OPTF_TITLE;
+			break;
+		case 'v':
+			ulOptions |= OPTF_VALIDATE;
 			break;
 		default:
 			usage();