OSDN Git Service

* strace.cc (main): Guard against previous setting of POSIXLY_CORRECT.
authorcgf <cgf>
Wed, 11 Feb 2004 00:29:42 +0000 (00:29 +0000)
committercgf <cgf>
Wed, 11 Feb 2004 00:29:42 +0000 (00:29 +0000)
winsup/utils/ChangeLog
winsup/utils/strace.cc

index 4609834..672e9af 100644 (file)
@@ -1,5 +1,9 @@
 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>
+
        * strace.cc: Update copyrights.
        * cygcheck.cc: Update copyrights.
 
index 4511b90..df42024 100644 (file)
@@ -903,13 +903,15 @@ main (int argc, char **argv)
   pid_t pid = 0;
   int opt;
   int toggle = 0;
+  int posixly_correct_set = getenv ("POSIXLY_CORRECT") != NULL;
 
   if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/')))
     pgm = *argv;
   else
     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)
     switch (opt)
       {
@@ -994,6 +996,8 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr);
   if (!ofile)
     ofile = stdout;
 
+  if (!posixly_correct_set)
+    putenv ("POSIXLY_CORRECT=");
   if (toggle)
     dotoggle (pid);
   else