#!/usr/bin/perl

BEGIN {
   # Look for the library
   @pos = split /:/,$ENV{PATH};

   $0 =~ s!/[^/]*$!!;
   if(length($0) > 2) {
      push @pos, $0;
   }

   foreach (@pos)
   {
      s/bin$/lib/;
      if(-f "$_/Gen.pm") {
         $libdir = $_ ;
         last;
      }
   } 

   die "Couldn't find the Architecture library (Gen.pm).\nI checked in @pos using your PATH variable (replacing bin with lib) and this executable's path.\n" if !defined($libdir);

   push @INC, "$libdir"; 
}

use Gen qw(genknob);
use Getopt::Std;

die "Usage: genknob mat name px py pz +-facey\n" if $#ARGV < 5;

genknob($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5]);
