debuggers.hg

changeset 22896:0db82ae4b446

xl: output illegal option character

Though illegal characters on xl command lines are catched, the user
isn't currently informed which one was not right.
This patch fixes this by printing the faulting character.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Andre Przywara <andre.przywara@amd.com>
date Tue Feb 01 19:05:51 2011 +0000 (2011-02-01)
parents a69965e61ae9
children 0e2c8b75f7d2
files tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/xl_cmdimpl.c	Mon Jan 31 17:47:24 2011 +0000
     1.2 +++ b/tools/libxl/xl_cmdimpl.c	Tue Feb 01 19:05:51 2011 +0000
     1.3 @@ -1762,7 +1762,7 @@ int main_memmax(int argc, char **argv)
     1.4              help("mem-max");
     1.5              exit(0);
     1.6          default:
     1.7 -            fprintf(stderr, "option not supported\n");
     1.8 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
     1.9              break;
    1.10          }
    1.11      }
    1.12 @@ -1809,7 +1809,7 @@ int main_memset(int argc, char **argv)
    1.13              help("mem-set");
    1.14              return 0;
    1.15          default:
    1.16 -            fprintf(stderr, "option not supported\n");
    1.17 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.18              break;
    1.19          }
    1.20      }
    1.21 @@ -1875,7 +1875,7 @@ int main_cd_eject(int argc, char **argv)
    1.22              help("cd-eject");
    1.23              return 0;
    1.24          default:
    1.25 -            fprintf(stderr, "option not supported\n");
    1.26 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.27              break;
    1.28          }
    1.29      }
    1.30 @@ -1903,7 +1903,7 @@ int main_cd_insert(int argc, char **argv
    1.31              help("cd-insert");
    1.32              return 0;
    1.33          default:
    1.34 -            fprintf(stderr, "option not supported\n");
    1.35 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.36              break;
    1.37          }
    1.38      }
    1.39 @@ -1944,7 +1944,7 @@ int main_console(int argc, char **argv)
    1.40              num = atoi(optarg);
    1.41              break;
    1.42          default:
    1.43 -            fprintf(stderr, "option not supported\n");
    1.44 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.45              break;
    1.46          }
    1.47      }
    1.48 @@ -1993,7 +1993,7 @@ int main_vncviewer(int argc, char **argv
    1.49              help("vncviewer");
    1.50              return 0;
    1.51          default:
    1.52 -            fprintf(stderr, "option not supported\n");
    1.53 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.54              break;
    1.55          }
    1.56      }
    1.57 @@ -2032,7 +2032,7 @@ int main_pcilist_assignable(int argc, ch
    1.58              help("pci-list-assignable-devices");
    1.59              return 0;
    1.60          default:
    1.61 -            fprintf(stderr, "option not supported\n");
    1.62 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.63              break;
    1.64          }
    1.65      }
    1.66 @@ -2069,7 +2069,7 @@ int main_pcilist(int argc, char **argv)
    1.67              help("pci-list");
    1.68              return 0;
    1.69          default:
    1.70 -            fprintf(stderr, "option not supported\n");
    1.71 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.72              break;
    1.73          }
    1.74      }
    1.75 @@ -2114,7 +2114,7 @@ int main_pcidetach(int argc, char **argv
    1.76              force = 1;
    1.77              break;
    1.78          default:
    1.79 -            fprintf(stderr, "option not supported\n");
    1.80 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.81              break;
    1.82          }
    1.83      }
    1.84 @@ -2155,7 +2155,7 @@ int main_pciattach(int argc, char **argv
    1.85              help("pci-attach");
    1.86              return 0;
    1.87          default:
    1.88 -            fprintf(stderr, "option not supported\n");
    1.89 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.90              break;
    1.91          }
    1.92      }
    1.93 @@ -2816,7 +2816,7 @@ int main_restore(int argc, char **argv)
    1.94              help("restore");
    1.95              return 0;
    1.96          default:
    1.97 -            fprintf(stderr, "option not supported\n");
    1.98 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
    1.99              break;
   1.100          }
   1.101      }
   1.102 @@ -2865,7 +2865,7 @@ int main_migrate_receive(int argc, char 
   1.103              debug = 1;
   1.104              break;
   1.105          default:
   1.106 -            fprintf(stderr, "option not supported\n");
   1.107 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.108              break;
   1.109          }
   1.110      }
   1.111 @@ -2894,7 +2894,7 @@ int main_save(int argc, char **argv)
   1.112              help("save");
   1.113              return 0;
   1.114          default:
   1.115 -            fprintf(stderr, "option not supported\n");
   1.116 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.117              break;
   1.118          }
   1.119      }
   1.120 @@ -2938,7 +2938,7 @@ int main_migrate(int argc, char **argv)
   1.121              debug = 1;
   1.122              break;
   1.123          default:
   1.124 -            fprintf(stderr, "option not supported\n");
   1.125 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.126              break;
   1.127          }
   1.128      }
   1.129 @@ -2998,7 +2998,7 @@ int main_pause(int argc, char **argv)
   1.130              help("pause");
   1.131              return 0;
   1.132          default:
   1.133 -            fprintf(stderr, "option not supported\n");
   1.134 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.135              break;
   1.136          }
   1.137      }
   1.138 @@ -3025,7 +3025,7 @@ int main_unpause(int argc, char **argv)
   1.139              help("unpause");
   1.140              return 0;
   1.141          default:
   1.142 -            fprintf(stderr, "option not supported\n");
   1.143 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.144              break;
   1.145          }
   1.146      }
   1.147 @@ -3051,7 +3051,7 @@ int main_destroy(int argc, char **argv)
   1.148              help("destroy");
   1.149              return 0;
   1.150          default:
   1.151 -            fprintf(stderr, "option not supported\n");
   1.152 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.153              break;
   1.154          }
   1.155      }
   1.156 @@ -3081,7 +3081,7 @@ int main_shutdown(int argc, char **argv)
   1.157              wait = 1;
   1.158              break;
   1.159          default:
   1.160 -            fprintf(stderr, "option not supported\n");
   1.161 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.162              break;
   1.163          }
   1.164      }
   1.165 @@ -3107,7 +3107,7 @@ int main_reboot(int argc, char **argv)
   1.166              help("reboot");
   1.167              return 0;
   1.168          default:
   1.169 -            fprintf(stderr, "option not supported\n");
   1.170 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.171              break;
   1.172          }
   1.173      }
   1.174 @@ -3153,7 +3153,7 @@ int main_list(int argc, char **argv)
   1.175              verbose = 1;
   1.176              break;
   1.177          default:
   1.178 -            fprintf(stderr, "option not supported\n");
   1.179 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.180              break;
   1.181          }
   1.182      }
   1.183 @@ -3204,7 +3204,7 @@ int main_list_vm(int argc, char **argv)
   1.184              help("list-vm");
   1.185              return 0;
   1.186          default:
   1.187 -            fprintf(stderr, "option not supported\n");
   1.188 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.189              break;
   1.190          }
   1.191      }
   1.192 @@ -3262,7 +3262,7 @@ int main_create(int argc, char **argv)
   1.193              quiet = 1;
   1.194              break;
   1.195          default:
   1.196 -            fprintf(stderr, "option not supported\n");
   1.197 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.198              break;
   1.199          }
   1.200      }
   1.201 @@ -3328,7 +3328,7 @@ int main_button_press(int argc, char **a
   1.202              help("button-press");
   1.203              return 0;
   1.204          default:
   1.205 -            fprintf(stderr, "option not supported\n");
   1.206 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.207              break;
   1.208          }
   1.209      }
   1.210 @@ -4103,7 +4103,7 @@ int main_debug_keys(int argc, char **arg
   1.211              help("debug-keys");
   1.212              return 0;
   1.213          default:
   1.214 -            fprintf(stderr, "option not supported\n");
   1.215 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.216              break;
   1.217          }
   1.218      }
   1.219 @@ -4138,7 +4138,7 @@ int main_dmesg(int argc, char **argv)
   1.220              help("dmesg");
   1.221              return 0;
   1.222          default:
   1.223 -            fprintf(stderr, "option not supported\n");
   1.224 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.225              break;
   1.226          }
   1.227      }
   1.228 @@ -5219,7 +5219,7 @@ int main_cpupoolcreate(int argc, char **
   1.229              dryrun = 1;
   1.230              break;
   1.231          default:
   1.232 -            fprintf(stderr, "option not supported\n");
   1.233 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.234              break;
   1.235          }
   1.236      }
   1.237 @@ -5416,7 +5416,7 @@ int main_cpupoollist(int argc, char **ar
   1.238              opt_cpus = 1;
   1.239              break;
   1.240          default:
   1.241 -            fprintf(stderr, "option not supported\n");
   1.242 +            fprintf(stderr, "option `%c' not supported.\n", optopt);
   1.243              break;
   1.244          }
   1.245      }