]> sjero.net Git - wget/blobdiff - src/main.c
Handle Ctrl-D, empty password.
[wget] / src / main.c
index e23a9b12db3e08d52e082de312be13c44f0a5643..228bb27fe2ef00dc2171b4e94ec9cebd1e382415 100644 (file)
@@ -56,7 +56,8 @@ as that of the covered work.  */
 #include "http.h"               /* for save_cookies */
 
 #include <getopt.h>
-#include "getpass.h"
+#include <getpass.h>
+#include <quote.h>
 
 #ifndef PATH_SEPARATOR
 # define PATH_SEPARATOR '/'
@@ -681,7 +682,7 @@ static char *
 prompt_for_password (void)
 {
   if (opt.user)
-    printf (_("Password for user \"%s\": "), opt.user);
+    printf (_("Password for user %s: "), quote (opt.user));
   else
     printf (_("Password: "));
   return getpass("");
@@ -914,11 +915,17 @@ will be placed in the single file you specified.\n\n"));
         }
       if (opt.timestamping)
         {
-          fputs (_("\
-Cannot specify -N if -O is given. See the manual for details.\n\n"), stdout);
-          print_usage ();
-          exit (1);
+          logprintf (LOG_NOTQUIET, "%s", _("\
+WARNING: timestamping does nothing in combination with -O. See the manual\n\
+for details.\n\n"));
+          opt.timestamping = false;
         }
+      if (opt.noclobber && file_exists_p(opt.output_document)) 
+           { 
+              /* Check if output file exists; if it does, exit. */
+              logprintf (LOG_VERBOSE, _("File `%s' already there; not retrieving.\n"), opt.output_document);
+              exit(1);
+           }  
     }
 
   if (opt.ask_passwd && opt.passwd)
@@ -1024,7 +1031,12 @@ Cannot specify -N if -O is given. See the manual for details.\n\n"), stdout);
       int dt;
 
       if (opt.ask_passwd)
-        opt.passwd = prompt_for_password ();
+        {
+          opt.passwd = prompt_for_password ();
+
+          if (opt.passwd == NULL || opt.passwd[0] == '\0')
+              exit (1);
+        }
 
       if ((opt.recursive || opt.page_requisites)
           && (url_scheme (*t) != SCHEME_FTP || url_uses_proxy (*t)))