* strace.cc (main): Guard against previous setting of POSIXLY_CORRECT.
This commit is contained in:
		| @@ -1,3 +1,7 @@ | |||||||
|  | 2004-02-10  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
|  | 	* strace.cc (main): Guard against previous setting of POSIXLY_CORRECT. | ||||||
|  |  | ||||||
| 2004-02-10  Christopher Faylor  <cgf@redhat.com> | 2004-02-10  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* strace.cc: Update copyrights. | 	* strace.cc: Update copyrights. | ||||||
|   | |||||||
| @@ -903,13 +903,15 @@ main (int argc, char **argv) | |||||||
|   pid_t pid = 0; |   pid_t pid = 0; | ||||||
|   int opt; |   int opt; | ||||||
|   int toggle = 0; |   int toggle = 0; | ||||||
|  |   int posixly_correct_set = getenv ("POSIXLY_CORRECT") != NULL; | ||||||
|  |  | ||||||
|   if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/'))) |   if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/'))) | ||||||
|     pgm = *argv; |     pgm = *argv; | ||||||
|   else |   else | ||||||
|     pgm++; |     pgm++; | ||||||
|  |  | ||||||
|   (void) putenv("POSIXLY_CORRECT=1"); |   if (!posixly_correct_set) | ||||||
|  |     (void) putenv("POSIXLY_CORRECT=1"); | ||||||
|   while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) |   while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) | ||||||
|     switch (opt) |     switch (opt) | ||||||
|       { |       { | ||||||
| @@ -994,6 +996,8 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr); | |||||||
|   if (!ofile) |   if (!ofile) | ||||||
|     ofile = stdout; |     ofile = stdout; | ||||||
|  |  | ||||||
|  |   if (!posixly_correct_set) | ||||||
|  |     putenv ("POSIXLY_CORRECT="); | ||||||
|   if (toggle) |   if (toggle) | ||||||
|     dotoggle (pid); |     dotoggle (pid); | ||||||
|   else |   else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user