lib/scripts/feeder.pl
author wenzelm
Sat, 20 Dec 2008 11:55:34 +0100
changeset 29145 b1c6f4563df7
parent 14981 e73f8140af78
child 39580 05daab5782f6
permissions -rw-r--r--
removed Ids;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     1
#
9789
wenzelm
parents: 6281
diff changeset
     2
# Author: Markus Wenzel, TU Muenchen
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     3
#
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     4
# feeder.pl - feed isabelle session
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     5
#
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     6
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     7
# args
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
     8
12111
d942348d8faf got rid of obsolete input filtering;
wenzelm
parents: 9961
diff changeset
     9
($head, $emitpid, $quit, $tail) = @ARGV;
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    10
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    11
4504
2f39aa4bebf3 removed -i option;
wenzelm
parents: 4501
diff changeset
    12
# setup signal handlers
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    13
4504
2f39aa4bebf3 removed -i option;
wenzelm
parents: 4501
diff changeset
    14
sub hangup { exit(0); }
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    15
$SIG{'HUP'} = "hangup";
4504
2f39aa4bebf3 removed -i option;
wenzelm
parents: 4501
diff changeset
    16
$SIG{'INT'} = "IGNORE";
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    17
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    18
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    19
# main
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    20
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    21
#buffer lines
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    22
$| = 1;
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    23
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    24
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    25
$emitpid && (print $$, "\n");
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    26
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    27
$head && (print "$head", "\n");
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    28
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    29
if (!$quit) {
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    30
    while (<STDIN>) {
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    31
	print;
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    32
    }
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    33
}
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    34
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    35
$tail && (print "$tail", "\n");
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    36
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    37
4504
2f39aa4bebf3 removed -i option;
wenzelm
parents: 4501
diff changeset
    38
# wait forever
4501
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    39
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    40
close STDOUT;
5f629ee2502b feed isabelle session;
wenzelm
parents:
diff changeset
    41
sleep;