[memprof: 70/76] src/main.c: Make it possible to pass options to the app under test



commit 119f5b5c58ef491bc316f9773bc35900566a0d7d
Author: Holger Hans Peter Freyther <zecke selfish org>
Date:   Mon Mar 29 07:55:49 2010 +0200

    src/main.c: Make it possible to pass options to the app under test
    
    Currently using ./memprof app --some-option would lead to --some-option
    being parsed by memprof and using -- before the application name lead
    to the attempt of starting an application called '--'. We simply check
    if the first remaining filename is a '--' and then just skip it.

 src/main.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 721d903..77c2bc2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,7 +4,7 @@
  * Copyright 1999, 2000, 2001, Red Hat, Inc.
  * Copyright 2002, Kristian Rietveld
  * Copyright 2002, Soeren Sandmann (sandmann daimi au dk)
- * Copyright 2009, Holger Hans Peter Fryther
+ * Copyright 2009, 2010, Holger Hans Peter Fryther
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1875,8 +1875,14 @@ main(int argc, char **argv)
 
        gtk_widget_show (initial_window->main_window);
 
-       if (argc > 1)
-	       run_file (initial_window, (char **)(argv + 1));
+       if (argc > 1) {
+               /* skip over -- */
+               gint start = 1;
+               if (strcmp (argv[start], "--") == 0)
+                    start = 2;
+
+	       run_file (initial_window, (char **)(argv + start));
+       }
 
        gtk_main ();
 



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