xdotool选项的问题

问题描述

xdotool手册页列出了一些试图使用并从中获取错误消息的选项。 例如xdotool --sync mousemove 100100 给 xdotool:无法识别的选项“ --sync” 用法:xdotool

另一个示例,xdotool --window 键入“ Hello world” 给 xdotool:无法识别的选项“ --window” 用法:xdotool

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 (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...