Commit 83a142e1 83a142e11e3fc5c06b2af3717ea69e993a909268 by Sergey Poznyakoff

Set g_argv[0] to the program file name for consistency with guile.

1 parent ed53a5f3
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 #include "guimb.h" 18 #include "guimb.h"
19 #include "getopt.h" 19 #include "getopt.h"
20 20
21 static char short_options[] = "de:f:g:hm:v"; 21 static char short_options[] = "de:f:g:hv";
22 static struct option long_options[] = { 22 static struct option long_options[] = {
23 {"debug", no_argument, 0, 'd'}, 23 {"debug", no_argument, 0, 'd'},
24 {"expression", required_argument, 0, 'e'}, 24 {"expression", required_argument, 0, 'e'},
...@@ -62,6 +62,7 @@ main (int argc, char *argv[]) ...@@ -62,6 +62,7 @@ main (int argc, char *argv[])
62 { 62 {
63 int c; 63 int c;
64 64
65 append_arg ("");
65 while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) 66 while ((c = getopt_long (argc, argv, short_options, long_options, NULL))
66 != -1) 67 != -1)
67 switch (c) 68 switch (c)
...@@ -89,6 +90,8 @@ main (int argc, char *argv[]) ...@@ -89,6 +90,8 @@ main (int argc, char *argv[])
89 "Invalid argument. Try guimb --help for more info\n"); 90 "Invalid argument. Try guimb --help for more info\n");
90 exit (1); 91 exit (1);
91 } 92 }
93 if (program_file)
94 g_argv[0] = program_file;
92 append_arg (NULL); 95 append_arg (NULL);
93 g_argc--; 96 g_argc--;
94 97
......