summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-05-25 01:18:53 -0400
committerJune McEnroe <june@causal.agency>2018-05-25 01:18:53 -0400
commitc2eb2eeda3782b122737977f43fdfa5f05ced259 (patch)
tree01634d6b8f498d8fbbd9a2f143c99257470ac29f /bin
parentUse PF_UNIX (diff)
downloadsrc-c2eb2eeda3782b122737977f43fdfa5f05ced259.tar.gz
src-c2eb2eeda3782b122737977f43fdfa5f05ced259.zip
Use break; case style everywhere*
*Except in switches where every branch does a return.
Diffstat (limited to '')
-rw-r--r--bin/brot.c38
-rw-r--r--bin/gfxx.c113
-rw-r--r--bin/glitch.c18
-rw-r--r--bin/pngo.c8
-rw-r--r--bin/scheme.c14
-rw-r--r--bin/xx.c14
6 files changed, 103 insertions, 102 deletions
diff --git a/bin/brot.c b/bin/brot.c
index 9b063871..576ca770 100644
--- a/bin/brot.c
+++ b/bin/brot.c
@@ -89,20 +89,20 @@ static double scaleStep = 1.0 / 32.0;
 bool input(char in) {
 	const double PI = acos(-1.0);
 	switch (in) {
-		case 'q': return false;
-				  break; case '.': depth++;
-				  break; case ',': if (depth > 1) depth--;
-				  break; case 'l': translate += translateStep * transform;
-				  break; case 'h': translate -= translateStep * transform;
-				  break; case 'j': translate += translateStep * I * transform;
-				  break; case 'k': translate -= translateStep * I * transform;
-				  break; case 'u': transform *= cexp(rotateStep * PI * I);
-				  break; case 'i': transform /= cexp(rotateStep * PI * I);
-				  break; case '+': transform *= 1.0 - scaleStep;
-				  break; case '-': transform /= 1.0 - scaleStep;
-				  break; case '0': translate = -0.75; transform = 2.5;
-				  break; case ']': samples++;
-				  break; case '[': if (samples > 1) samples--;
+		break; case 'q': return false;
+		break; case '.': depth++;
+		break; case ',': if (depth > 1) depth--;
+		break; case 'l': translate += translateStep * transform;
+		break; case 'h': translate -= translateStep * transform;
+		break; case 'j': translate += translateStep * I * transform;
+		break; case 'k': translate -= translateStep * I * transform;
+		break; case 'u': transform *= cexp(rotateStep * PI * I);
+		break; case 'i': transform /= cexp(rotateStep * PI * I);
+		break; case '+': transform *= 1.0 - scaleStep;
+		break; case '-': transform /= 1.0 - scaleStep;
+		break; case '0': translate = -0.75; transform = 2.5;
+		break; case ']': samples++;
+		break; case '[': if (samples > 1) samples--;
 	}
 	return true;
 }
@@ -136,11 +136,11 @@ int init(int argc, char *argv[]) {
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "f:i:s:t:"))) {
 		switch (opt) {
-			case 'f': transform = parseComplex(optarg); break;
-			case 'i': depth = strtoul(optarg, NULL, 0); break;
-			case 's': samples = strtoul(optarg, NULL, 0); break;
-			case 't': translate = parseComplex(optarg); break;
-			default: return EX_USAGE;
+			break; case 'f': transform = parseComplex(optarg);
+			break; case 'i': depth = strtoul(optarg, NULL, 0);
+			break; case 's': samples = strtoul(optarg, NULL, 0);
+			break; case 't': translate = parseComplex(optarg);
+			break; default: return EX_USAGE;
 		}
 	}
 	return EX_OK;
diff --git a/bin/gfxx.c b/bin/gfxx.c
index 0843e05e..9e3c940e 100644
--- a/bin/gfxx.c
+++ b/bin/gfxx.c
@@ -74,36 +74,39 @@ int init(int argc, char *argv[]) {
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "c:p:b:e:E:n:fmw:z:o:"))) {
 		switch (opt) {
-			case 'c': switch (optarg[0]) {
-				case 'i': space = COLOR_INDEXED; break;
-				case 'g': space = COLOR_GRAYSCALE; break;
-				case 'r': space = COLOR_RGB; break;
-				default: return EX_USAGE;
-			} break;
-			case 'p': pal = optarg; break;
-			case 'e': switch (optarg[0]) {
-				case 'l': byteOrder = ENDIAN_LITTLE; break;
-				case 'b': byteOrder = ENDIAN_BIG; break;
-				default: return EX_USAGE;
-			} break;
-			case 'E': switch (optarg[0]) {
-				case 'l': bitOrder = ENDIAN_LITTLE; break;
-				case 'b': bitOrder = ENDIAN_BIG; break;
-				default: return EX_USAGE;
-			} break;
-			case 'b': {
+			break; case 'c':
+				switch (optarg[0]) {
+					break; case 'i': space = COLOR_INDEXED;
+					break; case 'g': space = COLOR_GRAYSCALE;
+					break; case 'r': space = COLOR_RGB;
+					break; default: return EX_USAGE;
+				}
+			break; case 'p': pal = optarg;
+			break; case 'e':
+				switch (optarg[0]) {
+					break; case 'l': byteOrder = ENDIAN_LITTLE;
+					break; case 'b': byteOrder = ENDIAN_BIG;
+					break; default: return EX_USAGE;
+				}
+			break; case 'E':
+				switch (optarg[0]) {
+					break; case 'l': bitOrder = ENDIAN_LITTLE;
+					break; case 'b': bitOrder = ENDIAN_BIG;
+					break; default: return EX_USAGE;
+				}
+			break; case 'b': {
 				if (strlen(optarg) < 4) return EX_USAGE;
 				for (int i = 0; i < 4; ++i) {
 					bits[i] = optarg[i] - '0';
 				}
-			} break;
-			case 'n': offset  = strtoul(optarg, NULL, 0); break;
-			case 'f': flip   ^= true; break;
-			case 'm': mirror ^= true; break;
-			case 'w': width   = strtoul(optarg, NULL, 0); break;
-			case 'z': scale   = strtoul(optarg, NULL, 0); break;
-			case 'o': prefix  = optarg; break;
-			default: return EX_USAGE;
+			}
+			break; case 'n': offset = strtoul(optarg, NULL, 0);
+			break; case 'f': flip ^= true;
+			break; case 'm': mirror ^= true;
+			break; case 'w': width = strtoul(optarg, NULL, 0);
+			break; case 'z': scale = strtoul(optarg, NULL, 0);
+			break; case 'o': prefix = optarg;
+			break; default: return EX_USAGE;
 		}
 	}
 	if (argc > optind) path = argv[optind];
@@ -458,35 +461,35 @@ bool input(char in) {
 	size_t pixel = (BITS_TOTAL + 7) / 8;
 	size_t row = width * BITS_TOTAL / 8;
 	switch (in) {
-		case 'q': return false;
-				  break; case 'x': dump = DUMP_ONE;
-				  break; case 'X': dump ^= DUMP_ALL;
-				  break; case 'o': formatOptions(); printf("%s\n", options);
-				  break; case '[': if (!space--) space = COLOR__COUNT - 1;
-				  break; case ']': if (++space == COLOR__COUNT) space = 0;
-				  break; case 'p': palSample();
-				  break; case 'P': palDump();
-				  break; case '{': if (!preset--) preset = PRESETS_LEN - 1; setPreset();
-				  break; case '}': if (++preset == PRESETS_LEN) preset = 0; setPreset();
-				  break; case 'e': byteOrder ^= ENDIAN_BIG;
-				  break; case 'E': bitOrder ^= ENDIAN_BIG;
-				  break; case 'h': if (offset) offset--;
-				  break; case 'j': offset += pixel;
-				  break; case 'k': if (offset >= pixel) offset -= pixel;
-				  break; case 'l': offset++;
-				  break; case 'H': if (offset >= row) offset -= row;
-				  break; case 'J': offset += width * row;
-				  break; case 'K': if (offset >= width * row) offset -= width * row;
-				  break; case 'L': offset += row;
-				  break; case '.': width++;
-				  break; case ',': if (width > 1) width--;
-				  break; case '>': width *= 2;
-				  break; case '<': if (width > 1) width /= 2;
-				  break; case 'f': flip ^= true;
-				  break; case 'm': mirror ^= true;
-				  break; case '+': scale++;
-				  break; case '-': if (scale > 1) scale--;
-				  break; default: if (in >= '0' && in <= '9') setBit(in);
+		break; case 'q': return false;
+		break; case 'x': dump = DUMP_ONE;
+		break; case 'X': dump ^= DUMP_ALL;
+		break; case 'o': formatOptions(); printf("%s\n", options);
+		break; case '[': if (!space--) space = COLOR__COUNT - 1;
+		break; case ']': if (++space == COLOR__COUNT) space = 0;
+		break; case 'p': palSample();
+		break; case 'P': palDump();
+		break; case '{': if (!preset--) preset = PRESETS_LEN - 1; setPreset();
+		break; case '}': if (++preset == PRESETS_LEN) preset = 0; setPreset();
+		break; case 'e': byteOrder ^= ENDIAN_BIG;
+		break; case 'E': bitOrder ^= ENDIAN_BIG;
+		break; case 'h': if (offset) offset--;
+		break; case 'j': offset += pixel;
+		break; case 'k': if (offset >= pixel) offset -= pixel;
+		break; case 'l': offset++;
+		break; case 'H': if (offset >= row) offset -= row;
+		break; case 'J': offset += width * row;
+		break; case 'K': if (offset >= width * row) offset -= width * row;
+		break; case 'L': offset += row;
+		break; case '.': width++;
+		break; case ',': if (width > 1) width--;
+		break; case '>': width *= 2;
+		break; case '<': if (width > 1) width /= 2;
+		break; case 'f': flip ^= true;
+		break; case 'm': mirror ^= true;
+		break; case '+': scale++;
+		break; case '-': if (scale > 1) scale--;
+		break; default: if (in >= '0' && in <= '9') setBit(in);
 	}
 	return true;
 }
diff --git a/bin/glitch.c b/bin/glitch.c
index db2d3fae..a8c3bfff 100644
--- a/bin/glitch.c
+++ b/bin/glitch.c
@@ -460,18 +460,16 @@ int main(int argc, char *argv[]) {
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "a:cd:fo:pr"))) {
 		switch (opt) {
-			case 'a': {
+			break; case 'a':
 				options.applyFilter = parseFilters(options.applyFilters, optarg);
-			} break;
-			case 'c': stdio = true; break;
-			case 'd': {
+			break; case 'c': stdio = true;
+			break; case 'd':
 				options.declareFilter = parseFilters(options.declareFilters, optarg);
-			} break;
-			case 'f': options.filt = true; break;
-			case 'o': output = optarg; break;
-			case 'p': options.brokenPaeth = true; break;
-			case 'r': options.recon = true; break;
-			default: return EX_USAGE;
+			break; case 'f': options.filt = true;
+			break; case 'o': output = optarg;
+			break; case 'p': options.brokenPaeth = true;
+			break; case 'r': options.recon = true;
+			break; default: return EX_USAGE;
 		}
 	}
 
diff --git a/bin/pngo.c b/bin/pngo.c
index c4b3ed9b..f8359d3a 100644
--- a/bin/pngo.c
+++ b/bin/pngo.c
@@ -697,10 +697,10 @@ int main(int argc, char *argv[]) {
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "co:v"))) {
 		switch (opt) {
-			case 'c': stdio = true; break;
-			case 'o': output = optarg; break;
-			case 'v': verbose = true; break;
-			default: return EX_USAGE;
+			break; case 'c': stdio = true;
+			break; case 'o': output = optarg;
+			break; case 'v': verbose = true;
+			break; default: return EX_USAGE;
 		}
 	}
 
diff --git a/bin/scheme.c b/bin/scheme.c
index 3f4d70fd..1e4d9439 100644
--- a/bin/scheme.c
+++ b/bin/scheme.c
@@ -204,13 +204,13 @@ int main(int argc, char *argv[]) {
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "aghltx"))) {
 		switch (opt) {
-			case 'a': gen = ansi; break;
-			case 'g': out = png; break;
-			case 'h': out = hsv; break;
-			case 'l': out = linux; break;
-			case 't': gen = terminal; break;
-			case 'x': out = hex; break;
-			default: return EX_USAGE;
+			break; case 'a': gen = ansi;
+			break; case 'g': out = png;
+			break; case 'h': out = hsv;
+			break; case 'l': out = linux;
+			break; case 't': gen = terminal;
+			break; case 'x': out = hex;
+			break; default: return EX_USAGE;
 		}
 	}
 	struct Scheme scheme = gen();
diff --git a/bin/xx.c b/bin/xx.c
index 0b5ed184..ad62e924 100644
--- a/bin/xx.c
+++ b/bin/xx.c
@@ -107,13 +107,13 @@ int main(int argc, char *argv[]) {
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "ac:g:rsz"))) {
 		switch (opt) {
-			case 'a': options.ascii ^= true; break;
-			case 'c': options.cols = strtoul(optarg, NULL, 0); break;
-			case 'g': options.group = strtoul(optarg, NULL, 0); break;
-			case 'r': reverse = true; break;
-			case 's': options.offset ^= true; break;
-			case 'z': options.skip ^= true; break;
-			default: return EX_USAGE;
+			break; case 'a': options.ascii ^= true;
+			break; case 'c': options.cols = strtoul(optarg, NULL, 0);
+			break; case 'g': options.group = strtoul(optarg, NULL, 0);
+			break; case 'r': reverse = true;
+			break; case 's': options.offset ^= true;
+			break; case 'z': options.skip ^= true;
+			break; default: return EX_USAGE;
 		}
 	}
 	if (argc > optind) path = argv[optind];