~ubuntu-branches/ubuntu/raring/uml-utilities/raring

« back to all changes in this revision

Viewing changes to jail/tty_log.pl

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-04-14 17:59:45 UTC
  • mto: (4.1.3 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040414175945-yluoug8v60dnwmvu
Tags: upstream-20040406
ImportĀ upstreamĀ versionĀ 20040406

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
2
# Copyright (C) 2002, 2003 Jeff Dike (jdike@karaya.com)
 
3
# Licensed under the GPL
 
4
#
 
5
 
 
6
use tty_log;
 
7
 
 
8
use strict;
 
9
 
 
10
!@ARGV and die "Usage : perl tty_log.pl log-file";
 
11
 
 
12
my $file = $ARGV[0];
 
13
 
 
14
my @ops = read_log($file);
 
15
 
 
16
foreach my $op (@ops){
 
17
    if($op->{op} eq "open"){
 
18
        printf("Opening new tty 0x%x from tty 0x%x\n", $op->{tty}, 
 
19
               $op->{old_tty});
 
20
    }
 
21
    elsif($op->{op} eq "close"){
 
22
        printf("Closing tty 0x%x\n", $op->{tty});
 
23
    }
 
24
    elsif($op->{op} eq "write"){
 
25
        if($op->{direction} eq "read"){
 
26
            printf("Read from tty 0x%x - '%s'\n", $op->{tty}, $op->{string});
 
27
        }
 
28
        elsif($op->{direction} eq "write"){
 
29
            printf("Write to tty 0x%x - '%s'\n", $op->{tty}, $op->{string});
 
30
        }
 
31
        else {
 
32
            die "Bad direction - '$op->{direction}'";
 
33
        }
 
34
    }
 
35
    else {
 
36
        die "Bad op - " . $op->{op};
 
37
    }
 
38
}