#/usr/local/bin/perl local ($SYS_quota)=148; local ($Q_QUOTAON)=1; local ($Q_QUOTAOFF)=2; local ($Q_SETQUOTA)=3; local ($Q_GETQUOTA)=4; local ($Q_SETQLIM)=5; local ($Q_SYNC)=6; @comments = ("","Absolute disk limit for user ","Preferred disk limit for user " ,"Current block count for user ","Maximum allocated files for user ", "Preferred file limit for user "); local ($dir) = "/dev/dsk/6s0\0"; local ($stat,$buf); if($< == 0){ print "view [change] quotas for which user? > "; chop($user = );} else{ print "Enter your login name > "; chop($user = );} @newvals = (); @uinfo = getpwnam($user); local ($dqblk) = pack("LLLLLLLL",0,0,0,0,0,0,0,0); $stat=syscall($SYS_quota,$Q_GETQUOTA,$dir,$uinfo[2]+0,$dqblk); if($stat != 0){die "You cant do that!!";} @retvals = unpack("LLLLLLLL",$dqblk); print("\n[1] $comments[1] $user > $retvals[0]\n"); print("\n[2] $comments[2] $user > $retvals[1]\n"); print("\n[3] $comments[3] $user > $retvals[2]\n"); print("\n[4] $comments[4] $user > $retvals[3]\n"); print("\n[5] $comments[5] $user > $retvals[4]\n"); if($< != 0){print "\nThanks for using Metronet!\n";exit 0;} @newvals = @retvals; while(1){ print "\nChange which parameter? (1-5), to quit. \"s\" to save new values > "; chop($num = ); if ($num eq ""){exit 0;} if($num eq "s"){ $dqblk = pack("LLLLLLLL",@newvals); $stat=syscall($SYS_quota,$Q_SETQLIM,$dir,$uinfo[2]+0,$dqblk); $stat=syscall($SYS_quota,$Q_SYNC,$dir,$uinfo[2]+0,$dqblk); exit(0);} if (($num < 1) || ($num > 5)){print "invalid number\n"; exit 0;} print "Enter new value for $comments[$num]$user ($newvals[$num-1])>"; chop($nval = ); if($nval eq ""){next;} $newvals[$num-1] = $nval; print "changing $comments[$num] to $newvals[$num-1] for $user\n"; }