184 lines
7.3 KiB
Diff
184 lines
7.3 KiB
Diff
From 558f94b786e731e208895588625cee6c46d32468 Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||
Date: Sat, 18 Jan 2025 12:16:49 +0100
|
||
Subject: [PATCH 2/4] src/daemon: reindent switch statement to avoid compiler
|
||
warnings
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Gcc reports that "warning: this ‘if’ clause does not guard..." for
|
||
every break statement squished at the end of the preceding logical
|
||
line. This just makes the code hard to read, use normal indentation.
|
||
|
||
While at it, drop the pointless array. The variable is kept to allow the
|
||
option string to be defined on a separate line.
|
||
---
|
||
src/daemon/cmdline.c | 141 ++++++++++++++++++++++++++++++-------------
|
||
1 file changed, 98 insertions(+), 43 deletions(-)
|
||
|
||
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
|
||
index 66c8ecc50e..6a89d69ec3 100644
|
||
--- a/src/daemon/cmdline.c
|
||
+++ b/src/daemon/cmdline.c
|
||
@@ -32,58 +32,113 @@
|
||
void cmdline(int argc, char **argv)
|
||
{
|
||
extern struct options option;
|
||
- char options[]="a:A::b:B:d:Dg:hi:kl:m:Mo:pr:R::s:S:t:Tuv23";
|
||
+ const char *options="a:A::b:B:d:Dg:hi:kl:m:Mo:pr:R::s:S:t:Tuv23";
|
||
int opt;
|
||
|
||
- /* initialize for the dual mouse */
|
||
+ /* initialize for the dual mouse */
|
||
mouse_table[2]=mouse_table[1]=mouse_table[0]; /* copy defaults */
|
||
which_mouse = mouse_table+1; /* use the first */
|
||
|
||
while ((opt = getopt(argc, argv, options)) != -1) {
|
||
switch (opt) {
|
||
- case 'a': (which_mouse->opt_accel) = atoi(optarg); break;
|
||
- case 'A': opt_aged++;
|
||
- if (optarg)
|
||
- opt_age_limit = atoi(optarg); break;
|
||
- case 'b': (which_mouse->opt_baud) = atoi(optarg); break;
|
||
- case 'B': (which_mouse->opt_sequence) = optarg; break;
|
||
- case 'd': (which_mouse->opt_delta) = atoi(optarg); break;
|
||
- case 'D': option.run_status = GPM_RUN_DEBUG; break;
|
||
- case 'g': (which_mouse->opt_glidepoint_tap)=atoi(optarg); break;
|
||
- case 'h': exit(usage(NULL));
|
||
- case 'i': (which_mouse->opt_time)=atoi(optarg); break;
|
||
- case 'k': check_kill(); break;
|
||
- case 'l': opt_lut = optarg; break;
|
||
- case 'm': add_mouse(GPM_ADD_DEVICE,optarg);
|
||
- (which_mouse->opt_dev) = optarg; break; /* GO AWAY!*/
|
||
- case 'M': opt_double++; option.repeater++;
|
||
- if (option.repeater_type == 0)
|
||
- option.repeater_type = "msc";
|
||
- which_mouse=mouse_table+2; break;
|
||
- case 'o': add_mouse(GPM_ADD_OPTIONS,optarg);
|
||
- gpm_report(GPM_PR_DEBUG,"options: %s",optarg);
|
||
- (which_mouse->opt_options) = optarg; break; /* GO AWAY */
|
||
- case 'p': opt_ptrdrag = 0; break;
|
||
+ case 'a':
|
||
+ (which_mouse->opt_accel) = atoi(optarg);
|
||
+ break;
|
||
+ case 'A':
|
||
+ opt_aged++;
|
||
+ if (optarg)
|
||
+ opt_age_limit = atoi(optarg);
|
||
+ break;
|
||
+ case 'b':
|
||
+ (which_mouse->opt_baud) = atoi(optarg);
|
||
+ break;
|
||
+ case 'B':
|
||
+ (which_mouse->opt_sequence) = optarg;
|
||
+ break;
|
||
+ case 'd':
|
||
+ (which_mouse->opt_delta) = atoi(optarg);
|
||
+ break;
|
||
+ case 'D':
|
||
+ option.run_status = GPM_RUN_DEBUG;
|
||
+ break;
|
||
+ case 'g':
|
||
+ (which_mouse->opt_glidepoint_tap)=atoi(optarg);
|
||
+ break;
|
||
+ case 'h':
|
||
+ exit(usage(NULL));
|
||
+ break;
|
||
+ case 'i':
|
||
+ (which_mouse->opt_time)=atoi(optarg);
|
||
+ break;
|
||
+ case 'k':
|
||
+ check_kill();
|
||
+ break;
|
||
+ case 'l':
|
||
+ opt_lut = optarg;
|
||
+ break;
|
||
+ case 'm':
|
||
+ add_mouse(GPM_ADD_DEVICE,optarg);
|
||
+ (which_mouse->opt_dev) = optarg;
|
||
+ break; /* GO AWAY!*/
|
||
+ case 'M':
|
||
+ opt_double++; option.repeater++;
|
||
+ if (option.repeater_type == 0)
|
||
+ option.repeater_type = "msc";
|
||
+ which_mouse=mouse_table+2;
|
||
+ break;
|
||
+ case 'o':
|
||
+ add_mouse(GPM_ADD_OPTIONS,optarg);
|
||
+ gpm_report(GPM_PR_DEBUG,"options: %s",optarg);
|
||
+ (which_mouse->opt_options) = optarg;
|
||
+ break; /* GO AWAY */
|
||
+ case 'p':
|
||
+ opt_ptrdrag = 0;
|
||
+ break;
|
||
case 'r':
|
||
- /* being called responsiveness, I must take the inverse */
|
||
- (which_mouse->opt_scale)=atoi(optarg);
|
||
- if(!(which_mouse->opt_scale) || (which_mouse->opt_scale) > 100) (which_mouse->opt_scale)=100; /* the maximum */
|
||
- else (which_mouse->opt_scale)=100/(which_mouse->opt_scale); break;
|
||
+ /* being called responsiveness, I must take the inverse */
|
||
+ (which_mouse->opt_scale)=atoi(optarg);
|
||
+ if(!(which_mouse->opt_scale) || (which_mouse->opt_scale) > 100)
|
||
+ (which_mouse->opt_scale)=100; /* the maximum */
|
||
+ else
|
||
+ (which_mouse->opt_scale)=100/(which_mouse->opt_scale);
|
||
+ break;
|
||
case 'R':
|
||
- option.repeater++;
|
||
- if (optarg) option.repeater_type = optarg;
|
||
- else option.repeater_type = "msc"; break;
|
||
- case 's': (which_mouse->opt_sample) = atoi(optarg); break;
|
||
- case 'S': if (optarg) opt_special = optarg;
|
||
- else opt_special=""; break;
|
||
- case 't': add_mouse(GPM_ADD_TYPE,optarg);
|
||
- (which_mouse->opt_type) = optarg; break; /* GO AWAY */
|
||
- case 'u': option.autodetect = 1; break;
|
||
- case 'T': opt_test++; break;
|
||
- case 'v': printf(GPM_MESS_VERSION "\n"); exit(0);
|
||
- case '2': (which_mouse->opt_three) = -1; break;
|
||
- case '3': (which_mouse->opt_three) = 1; break;
|
||
- default: exit(usage("commandline"));
|
||
+ option.repeater++;
|
||
+ if (optarg)
|
||
+ option.repeater_type = optarg;
|
||
+ else
|
||
+ option.repeater_type = "msc";
|
||
+ break;
|
||
+ case 's':
|
||
+ (which_mouse->opt_sample) = atoi(optarg);
|
||
+ break;
|
||
+ case 'S':
|
||
+ if (optarg)
|
||
+ opt_special = optarg;
|
||
+ else
|
||
+ opt_special="";
|
||
+ break;
|
||
+ case 't':
|
||
+ add_mouse(GPM_ADD_TYPE,optarg);
|
||
+ (which_mouse->opt_type) = optarg;
|
||
+ break; /* GO AWAY */
|
||
+ case 'u':
|
||
+ option.autodetect = 1;
|
||
+ break;
|
||
+ case 'T':
|
||
+ opt_test++;
|
||
+ break;
|
||
+ case 'v':
|
||
+ printf(GPM_MESS_VERSION "\n");
|
||
+ exit(0);
|
||
+ case '2':
|
||
+ (which_mouse->opt_three) = -1;
|
||
+ break;
|
||
+ case '3':
|
||
+ (which_mouse->opt_three) = 1;
|
||
+ break;
|
||
+ default:
|
||
+ exit(usage("commandline"));
|
||
}
|
||
}
|
||
}
|
||
--
|
||
2.47.1
|
||
|