From 0f0c49a630285af10c765e0b724896ff281e7b66 Mon Sep 17 00:00:00 2001 From: explosion-mental Date: Tue, 16 Aug 2022 10:54:31 +0200 Subject: code-style: don't indent switch cases (#358) The suckless coding style [^0] and the linux coding style [^1] both recommends not indenting switch cases. And it helps out people with lower resolution monitors. [^0]: https://suckless.org/coding_style/ [^1]: https://www.kernel.org/doc/html/v5.10/process/coding-style.html#indentation Co-authored-by: explosion-mental Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/358 Reviewed-by: NRK Co-authored-by: explosion-mental Co-committed-by: explosion-mental --- options.c | 198 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 99 insertions(+), 99 deletions(-) (limited to 'options.c') diff --git a/options.c b/options.c index 3b191ea..8e8baa7 100644 --- a/options.c +++ b/options.c @@ -132,105 +132,105 @@ void parse_options(int argc, char **argv) assert(op.optarg != NULL); } switch (opt) { - case '?': - fprintf(stderr, "%s\n", op.errmsg); - print_usage(); - exit(EXIT_FAILURE); - case 'A': - n = strtol(op.optarg, &end, 0); - if (*end != '\0' || n <= 0) - error(EXIT_FAILURE, 0, "Invalid argument for option -A: %s", op.optarg); - _options.framerate = n; - /* fall through */ - case 'a': - _options.animate = true; - break; - case 'b': - _options.hide_bar = true; - break; - case 'c': - _options.clean_cache = true; - break; - case 'e': - n = strtol(op.optarg, &end, 0); - if (*end != '\0') - error(EXIT_FAILURE, 0, "Invalid argument for option -e: %s", op.optarg); - _options.embed = n; - break; - case 'f': - _options.fullscreen = true; - break; - case 'G': - n = strtol(op.optarg, &end, 0); - if (*end != '\0') - error(EXIT_FAILURE, 0, "Invalid argument for option -G: %s", op.optarg); - _options.gamma = n; - break; - case 'g': - _options.geometry = op.optarg; - break; - case 'h': - print_usage(); - exit(EXIT_SUCCESS); - case 'i': - _options.from_stdin = true; - break; - case 'n': - n = strtol(op.optarg, &end, 0); - if (*end != '\0' || n <= 0) - error(EXIT_FAILURE, 0, "Invalid argument for option -n: %s", op.optarg); - _options.startnum = n - 1; - break; - case 'N': - _options.res_name = op.optarg; - break; - case 'o': - _options.to_stdout = true; - break; - case 'p': - _options.private_mode = true; - break; - case 'q': - _options.quiet = true; - break; - case 'r': - _options.recursive = true; - break; - case 'S': - n = strtof(op.optarg, &end) * 10; - if (*end != '\0' || n <= 0) - error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", op.optarg); - _options.slideshow = n; - break; - case 's': - s = strchr(scalemodes, op.optarg[0]); - if (s == NULL || *s == '\0' || strlen(op.optarg) != 1) - error(EXIT_FAILURE, 0, "Invalid argument for option -s: %s", op.optarg); - _options.scalemode = s - scalemodes; - break; - case 'T': - title_deprecation_notice(); /* TODO(v31): remove this option */ - break; - case 't': - _options.thumb_mode = true; - break; - case 'v': - print_version(); - exit(EXIT_SUCCESS); - case 'Z': - _options.scalemode = SCALE_ZOOM; - _options.zoom = 1.0f; - break; - case 'z': - n = strtol(op.optarg, &end, 0); - if (*end != '\0' || n <= 0) - error(EXIT_FAILURE, 0, "Invalid argument for option -z: %s", op.optarg); - _options.scalemode = SCALE_ZOOM; - _options.zoom = (float) n / 100.0f; - break; - case '0': - _options.using_null = true; - break; + case '?': + fprintf(stderr, "%s\n", op.errmsg); + print_usage(); + exit(EXIT_FAILURE); + case 'A': + n = strtol(op.optarg, &end, 0); + if (*end != '\0' || n <= 0) + error(EXIT_FAILURE, 0, "Invalid argument for option -A: %s", op.optarg); + _options.framerate = n; + /* fall through */ + case 'a': + _options.animate = true; + break; + case 'b': + _options.hide_bar = true; + break; + case 'c': + _options.clean_cache = true; + break; + case 'e': + n = strtol(op.optarg, &end, 0); + if (*end != '\0') + error(EXIT_FAILURE, 0, "Invalid argument for option -e: %s", op.optarg); + _options.embed = n; + break; + case 'f': + _options.fullscreen = true; + break; + case 'G': + n = strtol(op.optarg, &end, 0); + if (*end != '\0') + error(EXIT_FAILURE, 0, "Invalid argument for option -G: %s", op.optarg); + _options.gamma = n; + break; + case 'g': + _options.geometry = op.optarg; + break; + case 'h': + print_usage(); + exit(EXIT_SUCCESS); + case 'i': + _options.from_stdin = true; + break; + case 'n': + n = strtol(op.optarg, &end, 0); + if (*end != '\0' || n <= 0) + error(EXIT_FAILURE, 0, "Invalid argument for option -n: %s", op.optarg); + _options.startnum = n - 1; + break; + case 'N': + _options.res_name = op.optarg; + break; + case 'o': + _options.to_stdout = true; + break; + case 'p': + _options.private_mode = true; + break; + case 'q': + _options.quiet = true; + break; + case 'r': + _options.recursive = true; + break; + case 'S': + n = strtof(op.optarg, &end) * 10; + if (*end != '\0' || n <= 0) + error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", op.optarg); + _options.slideshow = n; + break; + case 's': + s = strchr(scalemodes, op.optarg[0]); + if (s == NULL || *s == '\0' || strlen(op.optarg) != 1) + error(EXIT_FAILURE, 0, "Invalid argument for option -s: %s", op.optarg); + _options.scalemode = s - scalemodes; + break; + case 'T': + title_deprecation_notice(); /* TODO(v31): remove this option */ + break; + case 't': + _options.thumb_mode = true; + break; + case 'v': + print_version(); + exit(EXIT_SUCCESS); + case 'Z': + _options.scalemode = SCALE_ZOOM; + _options.zoom = 1.0f; + break; + case 'z': + n = strtol(op.optarg, &end, 0); + if (*end != '\0' || n <= 0) + error(EXIT_FAILURE, 0, "Invalid argument for option -z: %s", op.optarg); + _options.scalemode = SCALE_ZOOM; + _options.zoom = (float) n / 100.0f; + break; + case '0': + _options.using_null = true; + break; } } -- cgit v1.2.3-54-g00ecf