bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Wget 1.13.4 v. VMS -- Various problems


From: Steven M. Schweda
Subject: Re: [Bug-wget] Wget 1.13.4 v. VMS -- Various problems
Date: Thu, 29 Sep 2011 09:40:02 -0500 (CDT)

> [...]
>       2   24135       confval = long_options[longindex].val;
> 
> Apparently, referencing "long_options[-1]" causes more trouble in a VMS
> environment than it does on a typical UNIX(-like) system.  [...]

   I still haven't looked at the details here, but I did notice that the
_second_ getopt_long() loop does things like:

      /* If LONGINDEX is unchanged, it means RET is referring a short
         option.  */
      if (longindex == -1)

rather than jumping right in and using "longindex" as a subscript. 
Perhaps the first getopt_long() loop should be so careful.


   Other helpful changes:

ALP $ gdiff -u src/log.c_orig src/log.c
--- src/log.c_orig      2011-07-29 08:43:44 -0500
+++ src/log.c   2011-09-29 08:43:17 -0500
@@ -573,14 +573,14 @@
     }
 }

-/* Close LOGFP, inhibit further logging and free the memory associated
-   with it.  */
+/* Close LOGFP (only if we opened it, not if it's stderr), inhibit
+   further logging and free the memory associated with it.  */
 void
 log_close (void)
 {
   int i;

-  if (logfp)
+  if (logfp && (logfp != stderr))
     fclose (logfp);
   logfp = NULL;
   inhibit_logging = true;

(This is particularly helpful if one is putting in debugging code like
"fprintf( stderr, [...])", but closing stderr seems like a poor idea in
any case.)


ALP $ gdiff -u src/main.c_orig src/main.c
--- src/main.c_orig     2011-09-06 08:50:11 -0500
+++ src/main.c  2011-09-29 09:15:31 -0500
@@ -1467,7 +1480,7 @@
     xfree (url[i]);
   cleanup ();

-  return get_exit_status ();
+  exit (get_exit_status ());
 }
 #endif /* TESTING */

   On VMS, "return x" from main() and "exit(x)" are not equivalent, and
only "exit(x)" can deal with status codes other than EXIT_FAILURE and
EXIT_SUCCESS in a reasonable way.  ("exit(x)" is used in many other
places, so I wouldn't expect any damage from using it in one more.)

------------------------------------------------------------------------

   Steven M. Schweda               address@hidden
   382 South Warwick Street        (+1) 651-699-9818
   Saint Paul  MN  55105-2547



reply via email to

[Prev in Thread] Current Thread [Next in Thread]