如何解决xdotool选项的问题
xdotool手册页列出了一些试图使用并从中获取错误消息的选项。 例如xdotool --sync mousemove 100100 给 xdotool:无法识别的选项“ --sync” 用法:xdotool
另一个示例,xdotool --window
xdotool版本3.20160805.1
我查看了源代码,它们都被列为有效选项,但我认为 代码在做正确的事...
在源文件cmd_mousemove.c中:
int ret = 0;
char *cmd = *context->argv;
char *window_arg = NULL;
struct mousemove mousemove;
mousemove.clear_modifiers = 0;
mousemove.polar_coordinates = 0;
mousemove.opsync = 0;
mousemove.screen = 0;
mousemove.x = 0;
mousemove.y = 0;
mousemove.step = 0;
int c;
typedef enum {
opt_unused,opt_help,opt_sync,opt_clearmodifiers,opt_polar,opt_screen,opt_step,opt_delay,opt_window
} optlist_t;
static struct option longopts[] = {
{ "clearmodifiers",no_argument,NULL,opt_clearmodifiers },{ "help",opt_help},{ "polar",opt_polar },{ "screen",required_argument,opt_screen },//{ "step",opt_step },{ "sync",opt_sync },//{ "delay",opt_delay },{ "window",opt_window },{ 0,0 },};
static const char *usage =
"Usage: %s [options] <x> <y>\n"
"-c,--clearmodifiers - reset active modifiers (alt,etc) while typing\n"
//"-d,--delay <MS> - sleeptime in milliseconds between steps.\n"
//"--step <STEP> - pixels to move each time along path to x,y.\n" "-p,--polar - Use polar coordinates. X as an angle,Y as distance\n"
"--screen SCREEN - which screen to move on,default is current screen\n"
"--sync - only exit once the mouse has moved\n"
"-w,--window <windowid> - specify a window to move relative to.\n";
int option_index;
while ((c = getopt_long_only(context->argc,context->argv,"+chw:pd:",longopts,&option_index)) != -1) {
switch (c) {
case 'c':
case opt_clearmodifiers:
mousemove.clear_modifiers = 1;
break;
case 'h':
case opt_help:
printf(usage,cmd);
consume_args(context,context->argc);
return EXIT_SUCCESS;
break;
case opt_screen:
mousemove.screen = atoi(optarg);
break;
case 'w':
case opt_window:
window_arg = strdup(optarg);
break;
case 'p':
case opt_polar:
mousemove.polar_coordinates = 1;
break;
case opt_step:
mousemove.step = atoi(optarg);
break;
case 'd':
case opt_delay:
mousemove.delay = strtoul(optarg,0) * 1000;
break;
case opt_sync:
mousemove.opsync = 1;
break;
default:
printf("unknown opt: %d\n",c);
fprintf(stderr,usage,cmd);
return EXIT_FAILURE;
}
}
在阅读getopt_long_only()的手册页时,我以为第3个参数对于列出的所有选项都不正确是错误的吗?具体来说,它不会将“ s”列为选项,即使它列出了,也将如何区分“ sync”与“ screen”?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。