From: Don Slutz Subject: [PATCH v5 17/17] xenctx: Fixup options checking. Date: Thu, 20 Mar 2014 15:07:05 -0400 Message-ID: <1395342425-16260-18-git-send-email-dslutz@verizon.com> References: <1395342425-16260-1-git-send-email-dslutz@verizon.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395342425-16260-1-git-send-email-dslutz@verizon.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Campbell , Stefano Stabellini , George Dunlap , Ian Jackson , Don Slutz , Jan Beulich List-Id: xen-devel@lists.xenproject.org Also display the correct program name in all cases. Signed-off-by: Don Slutz --- tools/xentrace/xenctx.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index d6e85ac..164a13d 100644 --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -1110,6 +1110,7 @@ int main(int argc, char **argv) { int ch; int ret; + char *prog = argv[0]; #ifndef NO_TRANSLATION static const char *sopts = "fs:hak:SCn:b:l:DtTm:d:"; #else @@ -1176,7 +1177,7 @@ int main(int argc, char **argv) { fprintf(stderr, "%s: Unsupported value for --bytes-per-line. Needs to be 4 <= <= %d\n", - argv[0], MAX_BYTES_PER_LINE); + prog, MAX_BYTES_PER_LINE); exit(-1); } break; @@ -1190,7 +1191,7 @@ int main(int argc, char **argv) { fprintf(stderr, "%s: Unsupported value for --lines. Needs to be >= 0\n", - argv[0]); + prog); exit(-1); } break; @@ -1218,7 +1219,7 @@ int main(int argc, char **argv) usage(); exit(-1); case '?': - fprintf(stderr, "%s --help for more options\n", argv[0]); + fprintf(stderr, "%s --help for more options\n", prog); exit(-1); } } @@ -1235,7 +1236,7 @@ int main(int argc, char **argv) { fprintf(stderr, "%s both --frame-pointers and --dump-as-stack is not supported\n", - argv[0]); + prog); exit(-1); } #endif @@ -1246,8 +1247,17 @@ int main(int argc, char **argv) exit(-1); } - if (argc == 2) + if ( argc == 2 ) + { + if ( xenctx.all_vcpus ) + { + fprintf(stderr, + "%s both --all-vcpus and [VCPU] is not supported\n", + prog); + exit(-1); + } vcpu = atoi(argv[1]); + } if (symbol_table) read_symbol_table(symbol_table); -- 1.8.4