]> sjero.net Git - wget/blobdiff - src/main.c
Steven Schweda's VMS patch.
[wget] / src / main.c
index b1e99695f19f124bc45af691a145be5b9324bc98..3e32c40967e342c4874ece4901095f07e0f8486b 100644 (file)
@@ -57,6 +57,12 @@ as that of the covered work.  */
 
 #include <getopt.h>
 
+#ifdef __VMS
+#include "vms.h"
+#endif /* __VMS */
+
+#include "version.h"
+
 #ifndef PATH_SEPARATOR
 # define PATH_SEPARATOR '/'
 #endif
@@ -167,6 +173,9 @@ static struct cmdline_option option_data[] =
     { "force-directories", 'x', OPT_BOOLEAN, "dirstruct", -1 },
     { "force-html", 'F', OPT_BOOLEAN, "forcehtml", -1 },
     { "ftp-password", 0, OPT_VALUE, "ftppassword", -1 },
+#ifdef __VMS
+    { "ftp-stmlf", 0, OPT_BOOLEAN, "ftpstmlf", -1 },
+#endif /* def __VMS */
     { "ftp-user", 0, OPT_VALUE, "ftpuser", -1 },
     { "glob", 0, OPT_BOOLEAN, "glob", -1 },
     { "header", 0, OPT_VALUE, "header", -1 },
@@ -568,6 +577,10 @@ HTTPS (SSL/TLS) options:\n"),
 
     N_("\
 FTP options:\n"),
+#ifdef __VMS
+    N_("\
+       --ftp-stmlf             Use Stream_LF format for all binary FTP files.\n"),
+#endif /* def __VMS */
     N_("\
        --ftp-user=USER         set ftp user to USER.\n"),
     N_("\
@@ -594,8 +607,13 @@ Recursive download:\n"),
        --delete-after       delete files locally after downloading them.\n"),
     N_("\
   -k,  --convert-links      make links in downloaded HTML point to local files.\n"),
+#ifdef __VMS
+    N_("\
+  -K,  --backup-converted   before converting file X, back up as X_orig.\n"),
+#else /* def __VMS */
     N_("\
   -K,  --backup-converted   before converting file X, back up as X.orig.\n"),
+#endif /* def __VMS [else] */
     N_("\
   -m,  --mirror             shortcut for -N -r -l inf --no-remove-listing.\n"),
     N_("\
@@ -638,7 +656,7 @@ Recursive accept/reject:\n"),
   int i;
 
   printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
-          version_string);
+          VERSION_STRING);
   print_usage ();
 
   for (i = 0; i < countof (help); i++)
@@ -676,7 +694,12 @@ secs_to_human_time (double interval)
 static void
 print_version (void)
 {
-  printf ("GNU Wget %s\n\n", version_string);
+#ifdef __VMS
+  printf ("GNU Wget %s built on VMS %s %s.\n\n",
+   VERSION_STRING, vms_arch(), vms_vers());
+#else /* def __VMS */
+  printf ("GNU Wget %s built on %s.\n\n", VERSION_STRING, OS_TYPE);
+#endif /* def __VMS */
   /* TRANSLATORS: When available, an actual copyright character
      (cirle-c) should be used in preference to "(C)". */
   fputs (_("\
@@ -939,10 +962,19 @@ Can't timestamp and not clobber old files at the same time.\n"));
   /* Initialize logging.  */
   log_init (opt.lfilename, append_to_log);
 
-  DEBUGP (("DEBUG output created by Wget %s on %s.\n\n", version_string,
-           OS_TYPE));
+  DEBUGP (("DEBUG output created by Wget %s on %s.\n\n",
+           VERSION_STRING, OS_TYPE));
 
   /* Open the output filename if necessary.  */
+
+/* 2005-04-17 SMS.
+   Note that having the output_stream ("-O") file opened here for an FTP
+   URL rather than in getftp() (ftp.c) (and the http equivalent) rather
+   limits the ability in VMS to open the file differently for ASCII
+   versus binary FTP there.  (Of course, doing it here allows a open
+   failure to be detected immediately, without first connecting to the
+   server.)
+*/
   if (opt.output_document)
     {
       if (HYPHENP (opt.output_document))
@@ -950,8 +982,20 @@ Can't timestamp and not clobber old files at the same time.\n"));
       else
         {
           struct_fstat st;
+
+#ifdef __VMS
+/* Common fopen() optional arguments:
+   sequential access only, access callback function.
+*/
+# define FOPEN_OPT_ARGS , "fop=sqo", "acc", acc_cb, &open_id
+          int open_id = 7;
+#else /* def __VMS */
+# define FOPEN_OPT_ARGS
+#endif /* def __VMS [else] */
+
           output_stream = fopen (opt.output_document,
-                                 opt.always_rest ? "ab" : "wb");
+                                 opt.always_rest ? "ab" : "wb"
+                                 FOPEN_OPT_ARGS);
           if (output_stream == NULL)
             {
               perror (opt.output_document);
@@ -962,6 +1006,20 @@ Can't timestamp and not clobber old files at the same time.\n"));
         }
     }
 
+#ifdef __VMS
+  /* Set global ODS5 flag according to the specified destination (if
+     any), otherwise according to the current default device.
+  */
+  if (output_stream == NULL)
+    {
+      set_ods5_dest( "SYS$DISK");
+    }
+  else if (output_stream != stdout)
+    {
+      set_ods5_dest( opt.output_document);
+    }
+#endif /* def __VMS */
+
 #ifdef WINDOWS
   ws_startup ();
 #endif