diff -U3 -r wget-1.10.2/src/init.c wget-1.10.2-watchpid/src/init.c
--- wget-1.10.2/src/init.c	Tue Aug 09 00:54:16 2005
+++ wget-1.10.2-watchpid/src/init.c	Sat Dec 25 00:28:46 2010
@@ -242,7 +242,8 @@
   { "useragent",	NULL,			cmd_spec_useragent },
   { "verbose",		&opt.verbose,		cmd_boolean },
   { "wait",		&opt.wait,		cmd_time },
-  { "waitretry",	&opt.waitretry,		cmd_time }
+  { "waitretry",	&opt.waitretry,		cmd_time },
+  { "watchpid",		&opt.watchpid,		cmd_number }
 };
 
 /* Look up CMDNAME in the commands[] and return its position in the
diff -U3 -r wget-1.10.2/src/main.c wget-1.10.2-watchpid/src/main.c
--- wget-1.10.2/src/main.c	Fri Jul 01 03:20:30 2005
+++ wget-1.10.2-watchpid/src/main.c	Sat Dec 25 00:26:29 2010
@@ -265,6 +265,7 @@
     { "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
     { "wait", 'w', OPT_VALUE, "wait", -1 },
     { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
+    { "watchpid", 0, OPT_VALUE, "watchpid", -1 },
   };
 
 #undef IF_DEBUG
@@ -456,6 +457,8 @@
   -w,  --wait=SECONDS            wait SECONDS between retrievals.\n"),
     N_("\
        --waitretry=SECONDS       wait 1..SECONDS between retries of a retrieval.\n"),
+    N_("\
+       --watchpid=PID            if the process PID dies, wget also terminates itself.\n"),
     N_("\
        --random-wait             wait from 0...2*WAIT secs between retrievals.\n"),
     N_("\
diff -U3 -r wget-1.10.2/src/options.h wget-1.10.2-watchpid/src/options.h
--- wget-1.10.2/src/options.h	Tue Aug 09 00:54:16 2005
+++ wget-1.10.2-watchpid/src/options.h	Sat Dec 25 00:27:32 2010
@@ -108,6 +108,7 @@
   int random_wait;		/* vary from 0 .. wait secs by random()? */
   double wait;			/* The wait period between retrievals. */
   double waitretry;		/* The wait period between retries. - HEH */
+  int watchpid;			/* What PID to monitor for terminating. */
   int use_robots;		/* Do we heed robots.txt? */
 
   wgint limit_rate;		/* Limit the download rate to this
diff -U3 -r wget-1.10.2/src/retr.c wget-1.10.2-watchpid/src/retr.c
--- wget-1.10.2/src/retr.c	Sat Jun 25 17:07:12 2005
+++ wget-1.10.2-watchpid/src/retr.c	Sun Dec 26 03:28:17 2010
@@ -313,6 +313,33 @@
       if (opt.limit_rate)
 	limit_bandwidth (ret, timer);
 
+      if (opt.watchpid) 
+	{
+#ifdef WINDOWS
+	  DWORD exit_code = 0;
+	  HANDLE process = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, opt.watchpid);
+	  if (process) 
+	    {
+	      /* Unfortunately in Windows OpenProcess returns process handle (zomby?)
+	         even if the process is dead, but if this process holds STDOUT/STDERR
+	         of wget. So we must always check exitcode, not non-null result only. 
+	         Exitcode STILL_ACTIVE (259) is reserved in WINAPI for alive processes.
+	      */
+	      GetExitCodeProcess (process, &exit_code);    	
+	      CloseHandle (process);
+	    }
+
+	  if (exit_code != 259)  /* 259 = STILL_ACTIVE, see http://msdn.microsoft.com/en-us/library/ms683189.aspx */
+#else
+	  if (kill (opt.watchpid, 0) != 0)
+#endif
+	    {
+	      logprintf (LOG_NOTQUIET, _("\nWatched process %d is dead, aborting wget.\n"), opt.watchpid);
+	      ret = -2;
+	      goto out_;
+	    }
+	}
+      	
       if (progress)
 	progress_update (progress, ret, ptimer_read (timer));
 #ifdef WINDOWS
