Ok, hop suggested a script solution using redirect, but I figured that
I'd add the feature to the client faster than figuring out how to write
such a script. :)  (Besides he semi-promised to apply the patch.)  It
was very straight-forward to hack in.  I used normal fopen() and
fprintf(), instead of anything internal that may exists (didn't look
like it at a glance, though).  Patch is against 1.0.1.

*** lastlog.orig        Thu Jan 17 23:57:39 2002
--- lastlog.c   Fri Jan 18 00:31:14 2002
***************
*** 256,263 ****
--- 256,265 ----
        int     remove = 0;
        Lastlog *start_pos;
        char    *match = NULL,
+               *outfile = NULL,
                *arg;
        char    *blah = NULL;
+       FILE    *fp;
  
        message_from((char *) 0, LOG_CURRENT);
        cnt = current_window->lastlog_size;
***************
*** 290,295 ****
--- 292,303 ----
                                if (lines < 0)
                                        lines = 0;
                        }
+                       else if (!my_strnicmp(arg, "FILE", len))
+                       {
+                               char *ptr;
+                               if ((ptr = new_next_arg(args, &args)))
+                                       outfile = ptr;
+                       }
                        else if (!my_strnicmp(arg, "REVERSE", len))
                                reverse = 1;
                        else
***************
*** 380,385 ****
--- 388,402 ----
        else
                start_pos = current_window->lastlog_head;
  
+       if (outfile)
+       {
+               if ((fp = fopen(outfile, "a")) == NULL)
+               {
+                       say("Couldn't open output file");
+                       outfile = NULL;
+               }
+       }
+ 
        /* Let's not get confused here, display a seperator.. -lynx */
        if (header)
                say("Lastlog:");
***************
*** 399,405 ****
                        i++;
                        if (!match || wild_match(blah, start_pos->msg))
                        {
!                               put_it("%s", start_pos->msg);
                                if (!--lines)
                                        break;
                        }
--- 416,426 ----
                        i++;
                        if (!match || wild_match(blah, start_pos->msg))
                        {
!                               if (outfile)
!                                       fprintf(fp, "%s\n", start_pos->msg);
!                               else
!                                       put_it("%s", start_pos->msg);
! 
                                if (!--lines)
                                        break;
                        }
***************
*** 407,412 ****
--- 428,435 ----
        }
        if (header)
                say("End of Lastlog");
+       if (outfile)
+               fclose(fp);
        current_window->lastlog_level = level;
        set_lastlog_msg_level(msg_level);
        message_from((char *) 0, LOG_CRAP);

-- 
Stian Sletner
_______________________________________________
List mailing list
[EMAIL PROTECTED]
http://epicsol.org/mailman/listinfo/list

Reply via email to