
# Main
#
# This Perl script lists the adapters in the server using the virtual file services for NetWare on Linux. 
# event file list using the manage.cmd file on the _admin volume.
#
{
	# User help function
	if ($ARGV[0] eq "/?" || $ARGV[0] eq "-?") 
	{
		print "USAGE: linuxGetAdInfo.pl".
			"Example: linuxGetAdInfo.pl";
		exit;
	}

	# Global Variables
	$server = $ARGV[0];
	$file = "+</_admin/Manage_NSS/manage.cmd"; # This is the MSS management file we are accessing.
	$i;  #incrmentor variable.
	$reply;	   # Variable used to read from file.
	$command; # This is the NSS xml command that will be the NSS request to the file.

	#for ($i=0; $i<2; $i++)
	#{ 
	
		# Open the file and check that it exists.
		open(NSSFILE, $file) 
  			or die "Error opening NSS management file ($!) on server";
		print "file is now open \n";
	
		seek NSSFILE, 0, 0;
	
  	
		$command = "<virtualIO><datastream name=\"command\"/></virtualIO><nssRequest><device><listDevices/></device></nssRequest>"; # Initializing the virtual file for sending a command.
		print $file;
		print "\n";
		print $command;
		print "\n";
	
		syswrite(NSSFILE, $command, length($command))
			or die "Error writing initialization to management file.";
	
			
		seek NSSFILE, 0, 0;
		
		sysread (NSSFILE, $reply, 10000);
			print $reply;
			print "\n";
			print "\n";
	
		close (NSSFILE);
		$file= "+</a/file.txt";
	#}
	
}

   	
