*** src/main.c.original	Thu Mar 15 13:28:32 2001
--- src/main.c	Thu Mar 15 13:39:04 2001
***************
*** 49,57 ****
--- 49,60 ----
  #endif
  static volatile int do_reconfigure = 0;
  static volatile int do_rotate = 0;
+ static volatile int do_redirect = 0;
  static volatile int do_shutdown = 0;
  
  static void mainRotate(void);
+ static void sigusr2redirect(int);
+ static void mainRedirect(void);
  static void mainReconfigure(void);
  static SIGHDLR rotate_logs;
  static SIGHDLR reconfigure;
***************
*** 89,95 ****
  	"       -f file   Use given config-file instead of\n"
  	"                 %s\n"
  	"       -h        Print help message.\n"
! 	"       -k reconfigure|rotate|shutdown|interrupt|kill|debug|check|parse\n"
  	"                 Parse configuration file, then send signal to \n"
  	"                 running copy (except -k parse) and exit.\n"
  	"       -s        Enable logging to syslog.\n"
--- 92,98 ----
  	"       -f file   Use given config-file instead of\n"
  	"                 %s\n"
  	"       -h        Print help message.\n"
! 	"       -k reconfigure|rotate|shutdown|interrupt|kill|redirect|check|parse\n"
  	"                 Parse configuration file, then send signal to \n"
  	"                 running copy (except -k parse) and exit.\n"
  	"       -s        Enable logging to syslog.\n"
***************
*** 169,175 ****
  #else
  		opt_send_signal = SIGUSR1;
  #endif
! 	    else if (!strncmp(optarg, "debug", strlen(optarg)))
  #ifdef _SQUID_LINUX_THREADS_
  		opt_send_signal = SIGTRAP;
  #else
--- 172,178 ----
  #else
  		opt_send_signal = SIGUSR1;
  #endif
! 	    else if (!strncmp(optarg, "redirect", strlen(optarg)))
  #ifdef _SQUID_LINUX_THREADS_
  		opt_send_signal = SIGTRAP;
  #else
***************
*** 238,243 ****
--- 241,257 ----
  #endif
  }
  
+ 
+ static void
+ sigusr2redirect_handle(int sig)
+ {
+     do_redirect = 1;
+ #if !HAVE_SIGACTION
+     signal(sig, sigusr2redirect_handle);
+ #endif
+ }
+ 
+ 
  #if ALARM_UPDATES_TIME
  static void
  time_tick(int sig)
***************
*** 403,408 ****
--- 417,429 ----
  }
  
  static void
+ mainRedirect(void)
+ {
+     redirectShutdown();
+     redirectInit();
+ }
+ 
+ static void
  setEffectiveUser(void)
  {
      leave_suid();		/* Run as non privilegied user */
***************
*** 541,550 ****
  
  #ifdef _SQUID_LINUX_THREADS_
      squid_signal(SIGQUIT, rotate_logs, SA_RESTART);
!     squid_signal(SIGTRAP, sigusr2_handle, SA_RESTART);
  #else
      squid_signal(SIGUSR1, rotate_logs, SA_RESTART);
!     squid_signal(SIGUSR2, sigusr2_handle, SA_RESTART);
  #endif
      squid_signal(SIGHUP, reconfigure, SA_RESTART);
      squid_signal(SIGTERM, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART);
--- 562,571 ----
  
  #ifdef _SQUID_LINUX_THREADS_
      squid_signal(SIGQUIT, rotate_logs, SA_RESTART);
!     squid_signal(SIGTRAP, sigusr2redirect_handle, SA_RESTART);
  #else
      squid_signal(SIGUSR1, rotate_logs, SA_RESTART);
!     squid_signal(SIGUSR2, sigusr2redirect_handle, SA_RESTART);
  #endif
      squid_signal(SIGHUP, reconfigure, SA_RESTART);
      squid_signal(SIGTERM, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART);
***************
*** 695,700 ****
--- 716,724 ----
  	} else if (do_rotate) {
  	    mainRotate();
  	    do_rotate = 0;
+ 	} else if (do_redirect) {
+ 	    mainRedirect();
+ 	    do_redirect = 0;
  	} else if (do_shutdown) {
  	    time_t wait = do_shutdown > 0 ? (int) Config.shutdownLifetime : 0;
  	    debug(1, 1) ("Preparing for shutdown after %d requests\n",
