gawk/gawk-posix-mode-argv0.patch

34 lines
860 B
Diff

Sun Oct 4 21:46:11 2009 Arnold D. Robbins <arnold@skeeve.com>
* main.c (main): Don't reset argv[0] to myname. In call
to `init_args', pass argv[0] if do_posix. Based on
Fedora bug report.
Index: main.c
===================================================================
RCS file: /d/mongo/cvsrep/gawk-stable/main.c,v
retrieving revision 1.24
diff -u -r1.24 main.c
--- main.c 9 Jul 2009 19:54:38 -0000 1.24
+++ main.c 4 Oct 2009 19:46:06 -0000
@@ -306,7 +306,6 @@
#undef STACK_SIZE
myname = gawk_name(argv[0]);
- argv[0] = (char *) myname;
os_arg_fixup(&argc, &argv); /* emulate redirection, expand wildcards */
/* remove sccs gunk */
@@ -586,7 +585,9 @@
optind++;
}
- init_args(optind, argc, myname, argv);
+ init_args(optind, argc,
+ do_posix ? argv[0] : myname,
+ argv);
(void) tokexpand();
#if defined(LC_NUMERIC)