[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scroll-back buffer



Pete Harlan <harlan@mymenus.com> writes:

> > How can I clear the scroll-back buffer when a use logs out (other than
> > changing tty's)?
> 
> Echo four thousand spaces from .bash_logout?

Another way:

        runvc false

where runvc is the following script:

   #!/bin/sh
   # Run something on a VC, from X, and switch back to X when done.
   # GPL Joey Hess, Thu, 10 Jul 1997 23:27:08 -0400
   exec open -s -- sh -c "$* ; chvt `getvc`"

and getvc is compiled from the following source

   /* getvc.c
    * Prints the number of the current VC to stdout. Most of this code
    * was ripped from the open program, and this code is GPL'd
    *
    * Joey Hess, Fri Apr  4 14:58:50 EST 1997
    */
   
   #include <sys/vt.h>
   #include <fcntl.h>
   
   main () {
     int fd = 0;
     struct vt_stat vt;
   
     if ((fd = open("/dev/console",O_WRONLY,0)) < 0) {
       perror("Failed to open /dev/console\n");
               return(2);
     }
     if (ioctl(fd, VT_GETSTATE, &vt) < 0) {
       perror("can't get VTstate\n");
       close(fd);
       return(4);
     }
     printf("%d\n",vt.v_active);
   }
   
   /* End of getvc.c */

This method automates the switching of VC and can be run from .logout
(if you run a csh).

I use this script for 'runvc mc' from inside X.

        Torsten

-- 
"And pray that there's intelligent life somewhere up in space.
 Because there's bugger all down here on Earth"
                                            Monthy Python, Galaxy Song
PGP Public key available


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: