File: catchall.pl

package info (click to toggle)
thp 0.4.6-9
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 260 kB
  • sloc: perl: 1,088; sh: 154; makefile: 56
file content (25 lines) | stat: -rw-r--r-- 485 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
sub catchall {
  $ENV{'PATH'} = '/bin:/usr/bin';
  delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

  if ( $greeting != "" ) {
#TODO: This should check wether or not the command succeeds!
	  open(GREETING, "$greetbin|");
	  while(<GREETING>) {
		  print STDERR $_;
	  }
	  close(GREETING);
  }

  print STDERR "$prompt";

  while (<STDIN>) {
    open(LOG, ">>$sesslog");
    print STDERR "$prompt";
    print LOG $_;
    close(LOG);
    if (/exit|logout|quit/) {
	return;
    }
  }
}