#!/usr/bin/perl

# nisYPMake
# This script is called to update the NIS databases
# and to push them out to NIS slave servers.

# Set the $ypmake variable to the name of the program you 
# use to rebuild the NIS databases e.g.  If the command 
# was /var/yp/make, then use $ypmake = "/var/yp/make" ;
# Some OS's need something like:  "cd /var/yp/src ;/usr/ccs/bin/make"
$ypmake = "/var/yp/make" ;

# NOTE:  If you modify this code, you MUST change the version to
#        something over 100 to prevent it being replaced by future
#        versions of this script. 
$version = 2 ;

# Deal with possible spaces in the input 
foreach $i (0 .. $#ARGV) {
   $data .= "@ARGV[$i] " ;
}
chop($data) ;

# Output the version if requested
if($data eq "-v") {
    print "$version\n" ;
    exit(0) ;
}

# We want to see the output as it is happening, so use line buffering
select(stdout) ;$| = 1 ; select(stdout) ;

# Run the command
print "Calling nisYPMake\n" ;

`$ypmake` ;
