program QUOTA c c Iowa State University c Computation Center Accounting Office c Rodrick A Eldridge c September 1981, September 1982, May 1983 c implicit integer (A-Z) c include 'LIB:ISUDEF(QUOTA)/list' include 'LIB:ISUDEF(DFTQUOTA)/list' include 'LIB:ISUDEF(USER)/list' c include 'LIB:QUOTA(DECLARE)/list' c c initalize c call INTQUOTA (error) if (error) goto 999 c c trap , must exit by using EXIT commands c 100 if (control_c) then control_c = .false. ! reset interrupt call CTRLC (CANCEL,control_c) endif c c clear previous values c continue = .false. modify = 0 update_flag = 0 ! default /QUOTA do i = 1,mad_n mad_ans(i) = 0 mad_pos(i) = 0 mad_siz(i) = 0 enddo show_type = 1 ! default /FULL show_output = 0 ! default output to terminal show_flag = 1 ! default /USAGE do i = 1,4 sho_ans(i) = 0 sho_pos(i) = 0 sho_siz(i) = 0 enddo from_username = ' ' to_username = ' ' from_uic = 0 to_uic = 0 from_flag = 0 to_flag = 0 c c get commands line c 200 line = ' ' write (unit=command,fmt=1) 'QUOTA>' read (unit=input,fmt=2,end=700,err=200) length,line if (control_c) then goto 100 elseif (length .eq. 0) then goto 200 endif c c get and check commands c i = 1 word = SCAN (line,i,' /-') call STR$UPCASE (word,word(:TRIM(word))) line = line(i:length) l = TRIM (word) do k =1,8 if (word(:l) .eq. commands(k)(:l)) goto 300 enddo write (unit=output,fmt=3) 'Unrecognized command \' // word(:l) 1 // '\' goto 630 c c check for ambigous commands c 300 if (k .lt. 8) then do j = k+1,8 if (word(:l) .eq. commands(j)(:l)) then write (unit=output,fmt=3) 'Ambigous command \' // 1 word (:l) // '\' goto 630 endif enddo endif c c check for continued commands c 400 length = TRIM (line) if (line (length:length) .eq. '-') then continue = .true. line = line (:length-1) endif c c upcase line c if (word(:l) .ne. commands(4)(:l)) then call STR$UPCASE (line,line(:TRIM(line))) endif c c parse commands line c if (word(:l) .eq. commands(1)(:l)) then ! add mad_typ(1,21) = 0 ! do not accpet /QUOTA mad_typ(1,22) = 0 ! do not accept /COSTS mad_typ(1,23) = 0 ! do not accept /USAGE mad_typ(1,36) = 0 ! do not accpet /ACTIVATE mad_typ(1,37) = 0 ! do not accept /CANCEL mad_typ(1,38) = 2 ! accept /COPY mad_typ(1,39) = 0 ! do not accept /FORWARD status = PARSE (mad_n,mad_typ,mad_key,line, 1 mad_ans,mad_pos,mad_siz,msg) if (status .ne. 0) then goto 640 else if (mad_ans(1) .eq. 1) then mad_ans(1) = -1 range = line(mad_pos(1):mad_siz(1)) if (INDEX (range,'-') .ne. 0) goto 930 status = USERS (range,msg) if (status .ne. 0) goto 640 if (from_flag .lt. 0) goto 930 elseif (mad_ans(1) .eq. 0) then goto 940 endif call MADQUOTA (line,mad_pos,mad_siz,error) if (error) goto 630 endif elseif (word(:l) .eq. commands(2)(:l)) then ! default mad_typ(1,21) = 0 ! do not accept /QUOTA mad_typ(1,22) = 0 ! do not accept /COSTS mad_typ(1,23) = 0 ! do not accept /USAGE mad_typ(1,36) = 0 ! do not accept /ACTIVATE mad_typ(1,37) = 0 ! do not accept /CANCEL mad_typ(1,38) = 0 ! do not accept /COPY mad_typ(1,39) = 0 ! do not accept /FORWARD status = PARSE (mad_n,mad_typ,mad_key,line, 1 mad_ans,mad_pos,mad_siz,msg) if (status .ne. 0) then goto 640 else if (mad_ans(1) .eq. 1) 1 goto 910 call MADQUOTA (line,mad_pos,mad_siz,error) if (error) goto 630 endif elseif (word(:l) .eq. commands(3)(:l)) then ! exit do i = 1,length if (line(i:i) .ne. ' ') goto 920 enddo continue = .false. ! command can not be continued elseif (word(:l) .eq. commands(4)(:l)) then ! help continue = .false. ! command can not be continued elseif (word(:l) .eq. commands(5)(:l)) then ! modify mad_typ(1,21) = 1 ! accept /QUOTA mad_typ(1,22) = 1 ! accept /COSTS mad_typ(1,23) = 1 ! accept /USAGE mad_typ(1,36) = 1 ! accept /ACTIVATE mad_typ(1,37) = 1 ! accept /CANCEL mad_typ(1,38) = 0 ! do not accept /COPY mad_typ(1,39) = 1 ! accept /FORWARD status = PARSE (mad_n,mad_typ,mad_key,line, 1 mad_ans,mad_pos,mad_siz,msg) if (status .ne. 0) then goto 640 else if (mad_ans(1) .eq. 1) then mad_ans(1) = -1 range = line(mad_pos(1):mad_siz(1)) status = USERS (range,msg) if (status .ne. 0) goto 640 elseif (mad_ans(1) .eq. 0) then goto 940 endif call MADQUOTA (line,mad_pos,mad_siz,error) if (error) goto 630 endif elseif (word(:l) .eq. commands(6)(:l)) then ! remove i = 1 call GETWORD (line,i,range) do i = i,length if (line(i:i) .ne. ' ') goto 920 enddo status = USERS (range,msg) if (status .ne. 0) goto 640 continue = .false. ! command can not be continued elseif (word(:l) .eq. commands(7)(:l) .or. ! show 1 word(:l) .eq. commands(8)(:l)) then if (word(:l) .eq. commands(7)(:l)) then show_output = 0 sho_typ(1,2) = 1 ! accept /FULL sho_typ(2,2) = 1 ! accept /BRIEF sho_typ(1,4) = 1 ! accept /COSTS sho_typ(2,4) = 1 ! accept /USAGE elseif (word(:l) .eq. commands(8)(:l)) then show_output = 1 show_file = 'QUOTA.LIS' sho_typ(1,2) = 0 ! do not accept /FULL sho_typ(2,2) = 0 ! do not accept /BRIEF sho_typ(1,4) = 0 ! do not accept /COSTS sho_typ(2,4) = 0 ! do not accept /USAGE endif status = PARSE (sho_n,sho_typ,sho_key,line, 1 sho_ans,sho_pos,sho_siz,msg) if (status .ne. 0) then goto 640 else if (sho_ans(1) .eq. 1) then sho_ans(1) = -1 range = line(sho_pos(1):sho_siz(1)) status = USERS (range,msg) if (status .ne. 0) goto 640 elseif (sho_ans(1) .eq. 0) then goto 940 endif if (sho_ans(3) .eq. 1) then show_output = 1 ! /OUTPUT show_file = line(sho_pos(3):sho_siz(3)) endif if (sho_ans(2) .eq. 2) then show_type = 2 ! /BRIEF else if (show_output .eq. 1) then show_type = 2 ! /BRIEF else show_type = 1 ! /FULL endif endif if (sho_ans(4) .eq. 2) then show_flag = 2 ! /GROSS else show_flag = 1 ! /USAGE endif endif continue = .false. ! command can not be continued endif c c continued commands? c if (continue) then continue = .false. 500 write (unit=command,fmt=1) 'QUOTA>_' read (unit=input,fmt=2,end=700,err=500) length,line if (control_c) then goto 100 elseif (length .eq. 0) then goto 600 else call STR$UPCASE (line,line(:length)) goto 400 endif endif c c call commands routine c 600 if (word(:l) .eq. commands(1)(:l)) then ! add if (mad_ans(38) .ne. -1) copy_default = 'DEFAULT ' call ADDQUOTA elseif (word(:l) .eq. commands(2)(:l)) then ! default do i = 2,39 if (mad_ans(i) .eq. -1) goto 610 enddo goto 950 610 call DFTQUOTA elseif (word(:l) .eq. commands(3)(:l)) then ! exit goto 700 elseif (word(:l) .eq. commands(4)(:l)) then ! help call HLPQUOTA (line) elseif (word(:l) .eq. commands(5)(:l)) then ! modify do i = 2,39 if (mad_ans(i) .eq. -1) goto 620 enddo goto 950 620 call MODQUOTA elseif (word(:l) .eq. commands(6)(:l)) then ! remove call RMVQUOTA elseif (word(:l) .eq. commands(7)(:l) .or. ! show 1 word(:l) .eq. commands(8)(:l)) then call SHOQUOTA endif c 630 write (unit=command,fmt=3) ' ' goto 100 c c write error message c 640 write (unit=output,fmt=3) msg(:TRIM(msg)) goto 630 c c exit c 700 close (unit=update) if (modified) then write (unit=output,fmt=3) 'Quota file modified' else write (unit=output,fmt=3) 'No modifications made' endif goto 999 c c unrecognized qualifier keyword c 910 write (unit=output,fmt=3) 'Unrecognized qualifier keyword \' // 1 line(mad_pos(1):mad_siz(1)) // '\' goto 630 c c Superfluous text detected c 920 write (unit=output,fmt=3) 'Superfluous text detected \' // 1 line(i:length) // '\' goto 630 c c invalid user specification c 930 write (unit=output,fmt=3) 'Invalid user specification \' // 1 range(:TRIM(range)) // '\' goto 630 c c missing user specification c 940 write (unit=output,fmt=3) 'Missing user specification' goto 630 c c no qualifiers specified c 950 write (unit=output,fmt=3) 'No qualifiers specified' goto 630 c c end of run c 999 call EXIT end