#!/usr/bin/perl -T -I/h/COE/lib -w 

use strict;
use Coe;

my $VERSION="1.1.4.1";

if (@ARGV != 1) {
	&useage;
} 

sub useage { print "Useage: $0 username\n"; exit 1; }

my $arg1;
my $flag="false";
my $username="dummy";
my $path;

	$arg1=cleanString(shift,1);
#while (@ARGV > 0 ){
	if ("$arg1" eq "-h") {
 		print "Useage: $0 username\n";
   		exit;
	} elsif ("$arg1" eq "-H") {
   		print "HELP\n";
   		exit;
	} elsif ("$arg1" eq "-V") {
   		print "VERSION: $VERSION\n";
   		exit;
	}
        $username=$arg1;
#}

# --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----|
# do simple sanity checks
# --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----|

if ("$username" eq "dummy") { &useage }

# --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----|
# define some stuff
# --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----|

coeRun ("/usr/bin/sudo", "/usr/sbin/userdel", "-r", $username); 
# home directory is one above the "passwd login directory"
# so manual remove it
$path=coeFileConv("COE_USER/local/$username",3);
coeRun ("/usr/bin/sudo", "/bin/rm", "-r", $path);