From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH v5 17/17] xenctx: Fixup options checking. Date: Mon, 24 Mar 2014 10:26:58 -0400 Message-ID: <533040B2.5010702@terremark.com> References: <1395342425-16260-1-git-send-email-dslutz@verizon.com> <1395342425-16260-18-git-send-email-dslutz@verizon.com> <1395414781.19839.137.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395414781.19839.137.camel@kazak.uk.xensource.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: Ian Campbell , Don Slutz Cc: George Dunlap , Stefano Stabellini , Ian Jackson , Jan Beulich , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 03/21/14 11:13, Ian Campbell wrote: > On Thu, 2014-03-20 at 15:07 -0400, Don Slutz wrote: >> Also display the correct program name in all cases. > Where was it wrong? After: argv += optind; argc -= optind; and so #11's new error message is wrong. Will adjust this patch to be before #11. >> 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]; > const? Will add. -Don Slutz > >> #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); >