test for symbol table/package lookup bug
[urisagit/Stem.git] / bin / inetd_demo
CommitLineData
4536f655 1#!/usr/local/bin/perl -s
2
3$line_cnt = 10 ;
4$offset = 175 ;
5$base_off = 0 ;
6$xskip = ( $^O eq 'solaris' ) ? 600 : 500 ;
7
8my @children ;
9
10print "INETD: $ENV{PATH}\n" ;
11
12$SIG{ 'INT' } = \&cleanup ;
13
14if ( $s ) {
15
16 $ssfe = 'ssfe' ;
17 $prompt = '-prompt Stem:' ;
18 $echo = 'console_echo=1'
19# $prompt2 = '-prompt Chat:' ;
20}
21
22foreach $cmd ( split /\n/, <<EOT ) {
23xterm -T Stem -n Stem -geometry 80x40+XSKIP+0 -e $ssfe $prompt run_stem $echo inetd
24xterm -T A -n A -geometry 80xLINE+0+OFF -e $ssfe $prompt2 telnet localhost 6666
25xterm -T B -n B -geometry 80xLINE+0+OFF -e $ssfe $prompt2 telnet localhost 6667
26xterm -T C -n C -geometry 80xLINE+0+OFF -e $ssfe $prompt2 telnet localhost 6666
27xterm -T D -n D -geometry 80xLINE+0+OFF -e $ssfe $prompt2 telnet localhost 6667
28EOT
29
30 $cmd =~ s/XSKIP/$xskip/ ;
31
32 $cmd =~ s/LINE/$line_cnt/ ;
33 $cmd =~ s/OFF/$base_off/ and $base_off += $offset ;
34
35print "CMD $cmd\n" ;
36
37 @cmd = split ' ', $cmd ;
38
39 s/:/: / for @cmd ;
40
41 fork_exec( @cmd ) ;
42 sleep 4 unless $cmd =~ /localhost/ ;
43}
44
45
46while( <STDIN> ) {
47
48 next unless /^q/i ;
49
50 cleanup() ;
51}
52
53sub cleanup {
54
55 print "clean up\n" ;
56
57 kill 9, @children ;
58
59 wait ;
60 exit ;
61
62}
63
64sub fork_exec {
65
66 my( @exec ) = @_ ;
67
68 if ( $pid = fork() ) {
69
70 push @children, $pid ;
71 return ;
72 }
73
74 exec @exec ;
75}