]> sjero.net Git - wget/blobdiff - src/main.c
[svn] Add the POST method.
[wget] / src / main.c
index 49e979fb910ffae0bbe8940e67cd8c7c889cc2a1..f0fc34716ed1fb1cf1ac83a8b2ffeb0a7de31fd7 100644 (file)
@@ -41,8 +41,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #endif /* HAVE_NLS */
 #include <errno.h>
 
-#define OPTIONS_DEFINED_HERE   /* for options.h */
-
 #include "wget.h"
 #include "utils.h"
 #include "init.h"
@@ -75,7 +73,7 @@ struct options opt;
 /* From log.c.  */
 void log_init PARAMS ((const char *, int));
 void log_close PARAMS ((void));
-void redirect_output PARAMS ((const char *));
+void log_request_redirect_output PARAMS ((const char *));
 
 static RETSIGTYPE redirect_output_signal PARAMS ((int));
 
@@ -309,6 +307,8 @@ main (int argc, char *const *argv)
     { "no", required_argument, NULL, 'n' },
     { "output-document", required_argument, NULL, 'O' },
     { "output-file", required_argument, NULL, 'o' },
+    { "post-data", required_argument, NULL, 167 },
+    { "post-file", required_argument, NULL, 168 },
     { "progress", required_argument, NULL, 163 },
     { "proxy", required_argument, NULL, 'Y' },
     { "proxy-passwd", required_argument, NULL, 144 },
@@ -549,6 +549,12 @@ GNU General Public License for more details.\n"));
          setval ("egdfile", optarg);
          break;
 #endif /* HAVE_SSL */
+       case 167:
+         setval ("postdata", optarg);
+         break;
+       case 168:
+         setval ("postfile", optarg);
+         break;
        case 'A':
          setval ("accept", optarg);
          break;
@@ -679,11 +685,6 @@ GNU General Public License for more details.\n"));
        }
     }
 
-  /* Initialize progress.  Have to do this after the options are
-     processed so we know where the log file is.  */
-  if (opt.verbose)
-    set_progress_implementation (opt.progress_type);
-
   /* All user options have now been processed, so it's now safe to do
      interoption dependency checks. */
 
@@ -731,6 +732,11 @@ Can't timestamp and not clobber old files at the same time.\n"));
   if (opt.background)
     fork_to_background ();
 
+  /* Initialize progress.  Have to do this after the options are
+     processed so we know where the log file is.  */
+  if (opt.verbose)
+    set_progress_implementation (opt.progress_type);
+
   /* Allocate basic pointer.  */
   url = ALLOCA_ARRAY (char *, nurl + 1);
   /* Fill in the arguments.  */
@@ -738,10 +744,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
     {
       char *rewritten = rewrite_shorthand_url (argv[optind]);
       if (rewritten)
-       {
-         printf ("Converted %s to %s\n", argv[optind], rewritten);
-         url[i] = rewritten;
-       }
+       url[i] = rewritten;
       else
        url[i] = xstrdup (argv[optind]);
     }
@@ -889,15 +892,11 @@ Can't timestamp and not clobber old files at the same time.\n"));
 static RETSIGTYPE
 redirect_output_signal (int sig)
 {
-  char tmp[100];
-  signal (sig, redirect_output_signal);
-  /* Please note that the double `%' in `%%s' is intentional, because
-     redirect_output passes tmp through printf.  */
-  sprintf (tmp, _("%s received, redirecting output to `%%s'.\n"),
-          (sig == SIGHUP ? "SIGHUP" :
-           (sig == SIGUSR1 ? "SIGUSR1" :
-            "WTF?!")));
-  redirect_output (tmp);
+  char *signal_name = (sig == SIGHUP ? "SIGHUP" :
+                      (sig == SIGUSR1 ? "SIGUSR1" :
+                       "WTF?!"));
+  log_request_redirect_output (signal_name);
   progress_schedule_redirect ();
+  signal (sig, redirect_output_signal);
 }
 #endif /* HAVE_SIGNAL */