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

Re: [Xen-devel] [PATCH v5 17/17] xenctx: Fixup options checking.



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 <dslutz@xxxxxxxxxxx>
---
  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 <= 
<bytes> <= %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);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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