bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Wget manpage missing options


From: Steven M. Schweda
Subject: Re: [Bug-wget] Wget manpage missing options
Date: Fri, 12 Jul 2013 19:39:29 -0500 (CDT)

From: Giuseppe Scrivano <address@hidden>

> Yes, I was just waiting for an ACK from Steven if it works on VMS too.

   Seems to, if ".1" is supposed to be the most recent and ".n" the
oldest.  (VMS versions normally go the other way.)  Around here, with a
quick CGI counter, after five runs of:

      wgx -d --backups=3 http://alp-l/cgi-bin/counter.com

I got:

alp $ search counter.* "count ="

******************************
ALP$DKC0:[SMS.WGET]counter.com;1

count = 5

******************************
ALP$DKC0:[SMS.WGET]counter.com_1;1

count = 4

******************************
ALP$DKC0:[SMS.WGET]counter.com_2;1

count = 3

******************************
ALP$DKC0:[SMS.WGET]counter.com_3;1

count = 2

   Seems plausible to me.  What could go wrong?

   I don't know if the following other VMS-related changes are already
in somewhere else, or if they got lost (at one end or the other), or
what, but, as long as we're all here:

--- lib/tmpdir.c_orig   2013-07-11 15:23:39 -0500
+++ lib/tmpdir.c        2013-07-11 22:01:46 -0500
@@ -149,6 +149,15 @@
       return -1;
     }
 
+/* 2012-08-18 SMS.
+ * Sadly, on VMS, P_tmpdir is defined as "SYS$SCRATCH:", not a
+ * Posix-compatible name, so a VMS-specific scheme (no "/") must be used
+ * to concatenate the directory name and the file name.
+ */
+#ifdef __VMS
+  sprintf (tmpl, "%.*s%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+#else
   sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+#endif
   return 0;
 }


(Slightly more compact than before, if you have a "before":)

--- src/warc.c_orig     2013-07-04 04:40:52 -0500
+++ src/warc.c  2013-07-12 06:13:39 -0500
@@ -738,8 +738,14 @@
   char *new_filename = malloc (base_filename_length + 1 + 5 + 8 + 1);
   warc_current_filename = new_filename;
 
+#ifdef __VMS
+# define WARC_GZ "warc-gz"
+#else /* def __VMS */
+# define WARC_GZ "warc.gz"
+#endif /* def __VMS [else] */
+
 #ifdef HAVE_LIBZ
-  const char *extension = (opt.warc_compression_enabled ? "warc.gz" : "warc");
+  const char *extension = (opt.warc_compression_enabled ? WARC_GZ : "warc");
 #else
   const char *extension = "warc";
 #endif
@@ -1153,6 +1159,21 @@
   if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1)
     return NULL;
 
+#ifdef __VMS
+  /* 2013-07-12 SMS.
+   * mkostemp()+unlink()+fdopen() scheme causes trouble on VMS, so use
+   * mktemp() to uniquify the (VMS-style) name, and then use a normal
+   * fopen() with a "create temp file marked for delete" option.
+   */
+  {
+    char *tfn;
+
+    tfn = mktemp (filename);            /* Get unique name from template. */
+    if (tfn == NULL)
+      return NULL;                     
+    return fopen (tfn, "w+", "fop=tmd");    /* Create auto-delete temp file. */
+  }
+#else /* def __VMS */
   int fd = mkostemp (filename, O_TEMPORARY);
   if (fd < 0)
     return NULL;
@@ -1162,8 +1183,8 @@
     return NULL;
 #endif
 
-
   return fdopen (fd, "wb+");
+#endif /* def __VMS [else] */
 }
 
 
   As always, thanks for the extra VMS-related effort.  (Sorry about the
half-baked accusation of half-baked-ness earlier.  Well, _something_
was, just not your code.  Sigh.  But I did catch that "bool" thing, so I
may not be a total loss.)

   SMS.



reply via email to

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