#!/usr/bin/perl -w
use strict;

my ($self,$time,$i);

$self=$0; $self=~s/[^\/]+$//; $self.='bin/aline';
if (@ARGV) { shift @ARGV; }

system('open-x11'); $time=time();
rcc:
$i=`ps -auxwww | grep '[X]11'`; if (!length($i)) {
  if ((time()-$time)<10) { sleep 1; goto rcc; }
  print STDERR "Cannot run, X11 is not starting."; exit 12;
}

exec($self,@ARGV);
exit 0;
