[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: fix incorrect display of illegal option character



# HG changeset patch
# User Andre Przywara <andre.przywara@xxxxxxx>
# Date 1296237360 0
# Node ID 3e928084336fba1f4a7e666d0576f5943e63b874
# Parent  6d646586842035fc4a385893dd7fce96365baed5
xl: fix incorrect display of illegal option character

according to the getopt(3) manpage (and to my testing) getopt returns
'?' if an unknown option character is found and stores the insulting
character in optopt.
This patch fixes the broken output in such a situation:

root@dosorca:/data/images# xl vcpu-list -j
option `?' not supported.
Name                  ID  VCPU   CPU State   Time(s) CPU Affinity
Domain-0               0     0    0   -b-     193.1  any cpu

turns into:

root@dosorca:/data/images# xl vcpu-list -j
option `j' not supported.
Name                  ID  VCPU   CPU State   Time(s) CPU Affinity
Domain-0               0     0    0   -b-     193.1  any cpu

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   70 +++++++++++++++++++++++------------------------
 1 files changed, 35 insertions(+), 35 deletions(-)

diff -r 6d6465868420 -r 3e928084336f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Jan 28 17:45:24 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Fri Jan 28 17:56:00 2011 +0000
@@ -2974,7 +2974,7 @@ int main_dump_core(int argc, char **argv
             help("dump-core");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3481,7 +3481,7 @@ int main_vcpulist(int argc, char **argv)
             help("vcpu-list");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3572,7 +3572,7 @@ int main_vcpupin(int argc, char **argv)
             help("vcpu-pin");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3617,7 +3617,7 @@ int main_vcpuset(int argc, char **argv)
         help("vcpu-set");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3781,7 +3781,7 @@ int main_info(int argc, char **argv)
             numa = 1;
             break;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3853,7 +3853,7 @@ int main_sched_credit(int argc, char **a
             help("sched-credit");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3912,7 +3912,7 @@ int main_domid(int argc, char **argv)
             help("domid");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3946,7 +3946,7 @@ int main_domname(int argc, char **argv)
             help("domname");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -3987,7 +3987,7 @@ int main_rename(int argc, char **argv)
             help("rename");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4024,7 +4024,7 @@ int main_trigger(int argc, char **argv)
             help("trigger");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4065,7 +4065,7 @@ int main_sysrq(int argc, char **argv)
             help("sysrq");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4165,7 +4165,7 @@ int main_top(int argc, char **argv)
             help("top");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4188,7 +4188,7 @@ int main_networkattach(int argc, char **
             help("network-attach");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4269,7 +4269,7 @@ int main_networklist(int argc, char **ar
                 help("network-list");
                 return 0;
             default:
-                fprintf(stderr, "option `%c' not supported.\n", opt);
+                fprintf(stderr, "option `%c' not supported.\n", optopt);
                 break;
         }
     }
@@ -4318,7 +4318,7 @@ int main_networkdetach(int argc, char **
             help("network-detach");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4364,7 +4364,7 @@ int main_blockattach(int argc, char **ar
             help("block-attach");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4437,7 +4437,7 @@ int main_blocklist(int argc, char **argv
             help("block-list");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4483,7 +4483,7 @@ int main_blockdetach(int argc, char **ar
             help("block-detach");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4522,7 +4522,7 @@ int main_network2attach(int argc, char *
             help("network2-attach");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4615,7 +4615,7 @@ int main_network2list(int argc, char **a
             help("network2-list");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4659,7 +4659,7 @@ int main_network2detach(int argc, char *
             help("network2-detach");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4858,7 +4858,7 @@ int main_uptime(int argc, char **argv)
             help("uptime");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4893,7 +4893,7 @@ int main_tmem_list(int argc, char **argv
             help("tmem-list");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4934,7 +4934,7 @@ int main_tmem_freeze(int argc, char **ar
             help("tmem-freeze");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -4970,7 +4970,7 @@ int main_tmem_destroy(int argc, char **a
             help("tmem-destroy");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5006,7 +5006,7 @@ int main_tmem_thaw(int argc, char **argv
             help("tmem-thaw");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5056,7 +5056,7 @@ int main_tmem_set(int argc, char **argv)
             help("tmem-set");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5114,7 +5114,7 @@ int main_tmem_shared_auth(int argc, char
             help("tmem-shared-auth");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5159,7 +5159,7 @@ int main_tmem_freeable(int argc, char **
             help("tmem-freeable");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5487,7 +5487,7 @@ int main_cpupooldestroy(int argc, char *
             help("cpupool-destroy");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5521,7 +5521,7 @@ int main_cpupoolrename(int argc, char **
             help("cpupool-rename");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5564,7 +5564,7 @@ int main_cpupoolcpuadd(int argc, char **
             help("cpupool-cpu-add");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5627,7 +5627,7 @@ int main_cpupoolcpuremove(int argc, char
             help("cpupool-cpu-remove");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5689,7 +5689,7 @@ int main_cpupoolmigrate(int argc, char *
             help("cpupool-migrate");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }
@@ -5746,7 +5746,7 @@ int main_cpupoolnumasplit(int argc, char
             help("cpupool-numa-split");
             return 0;
         default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
         }
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.