From:	ADVAX::"""PSI%JANET.000000000040::NICK%ncdlab.ulcc.ac.uk""@NSFNET-RELAY.AC.UK" "Nick de Smith" 19-JAN-1990 06:05
To:	EVERHART <EVERHART%arisia.dnet.ge.com@NSFNET-RELAY.AC.UK>
Subj:	An extra for [.ATG...] - QUOTA 1/2 (part 2 follows)

Received: by ADVAX.DECnet (utk-mail11 v1.5) ; Fri, 19 Jan 90 06:06:14 EST
Received:  from mcnc by ge-dab.GE.COM (5.61/GE-DAB 1.10) with UUCP
	id AA23159 for everhart; Fri, 19 Jan 90 06:06:00 -0500
Received: from RELAY.CS.NET by mcnc.mcnc.org (5.59/MCNC/5-16-88)
	id AA12950; Fri, 19 Jan 90 05:53:35 EST
Message-Id: <9001191053.AA12950@mcnc.mcnc.org>
Received: from nsfnet-relay.ac.uk by RELAY.CS.NET id aa10400; 19 Jan 90 4:52 EST
Received: from sun.nsfnet-relay.ac.uk by vax.NSFnet-Relay.AC.UK 
           via Janet with NIFTP  id aa05703; 19 Jan 90 10:28 GMT
Date:           Fri, 19 Jan 90  10:36 BST
From: Nick de Smith <"PSI%JANET.000000000040::NICK%ncdlab.ulcc.ac.uk"@NSFNET-RELAY.AC.UK>
To: EVERHART <EVERHART%arisia.dnet.ge.com@NSFNET-RELAY.AC.UK>
Subject:        An extra for [.ATG...] - QUOTA 1/2 (part 2 follows)
 
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.1-004  3-AUG-1989
$!   On 19-JAN-1990 10:27:26.31   By user NICK 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 2 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. [.QUOTA]AAAREADME.1ST;1
$!       2. [.QUOTA]BUILD.COM;1
$!       3. [.QUOTA]DQFDEF.H;1
$!       4. [.QUOTA]QUOTA.C;1
$!       5. [.QUOTA]UAFDEF.H;1
$!       6. [.QUOTA]UAIDEF.H;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ if f$getsyi("version") .ges. "V4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete/nolog 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete/nolog 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");
buff:=CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(buff))
;LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(buff));g:=0;LOOP EXITIF MARK(NONE)=END_OF(buff);x:=
ERASE_CHARACTER(1);IF g = 0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x=
"V" THEN APPEND_LINE;MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;
IF x="+" THEN g:=1;ERASE_LINE;ENDIF;ELSE IF x="-" THEN g:=0;ENDIF;ERASE_LINE;
ENDIF;ENDLOOP;p:="`";POSITION(BEGINNING_OF(buff));LOOP r:=SEARCH(p,FORWARD);
EXITIF r=0;POSITION(r);ERASE(r);COPY_TEXT(ASCII(INT(ERASE_CHARACTER(3))));
ENDLOOP;o:=GET_INFO(COMMAND_LINE,"output_file");WRITE_FILE(buff,o);
ENDPROCEDURE;Unpacker;EXIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create/nolog 'f'
XNick de Smith
XApplied Telematics Group
X7 Vale Avenue
XTunbridge Wells
XKent TN1 1DJ
XEngland
X+44 892 511000
X
XThis program returns the diskquota information for a user in DCL local strin
Vg symbols:
X
X`009DISKQ_INUSE`009`009Symbol for inuse blocks
X`009DISKQ_PERMQUOTA`009`009Symbol for permanent quota
X`009DISKQ_OVERDRAFT`009`009Symbol for overdraft blocks
X
XThese symbols can be accessed by a DCL procedure and can be used in arithmet
Vic calculations.
X
XFormat:
X
X`009$ QUOTA`009= "disk:`091dir`093QUOTA"
X`009$!
X`009$ QUOTA`009username`009`009`009! Quota for "username" on their default d
Vevice
X or`009$ QUOTA`009dev:username`009`009`009! Quota for "username" on device "
Vdev"
X`009$!
X`009$ Sho Symbol DISKQ*/Local`009`009! Display results
X`009$!
$ CALL UNPACK [.QUOTA]AAAREADME.1ST;1 572479675
$ create/nolog 'f'
X$`009CC /Debug /Optimize=NOINLINE QUOTA.C
X$`009Link QUOTA.OBJ
X$!
X$`009QUOTA == "$" + F$Element( 0, ";", F$Parse( "QUOTA.EXE" ) )
$ CALL UNPACK [.QUOTA]BUILD.COM;1 1783112091
$ create/nolog 'f'
X/***************************************************************************
V**************************************
X
X`009DQFDEF.H
X
X VAX C language definitions from the LIB library.
X Extracted by NICK using VAXCDEF at 15-NOV-1989 12:34:50.11 on a MicroVAX II
V system under VMS V5.2
X
X****************************************************************************
V*************************************/
X
X#define`009DQF$M_ACTIVE`0090x1
X#define`009DQF$K_LENGTH`0090x20
X#define`009DQF$C_LENGTH`0090x20
X#define`009DQF$S_DQFDEF`0090x20
X#define`009DQF$L_FLAGS`0090x0
X#define`009DQF$V_ACTIVE`0090x0
X#define`009DQF$L_UIC`0090x4
X#define`009DQF$L_USAGE`0090x8
X#define`009DQF$L_PERMQUOTA`0090xC
X#define`009DQF$L_OVERDRAFT`0090x10
X
X/* End of DQFDEF.H */
$ CALL UNPACK [.QUOTA]DQFDEF.H;1 2117867374
$ create/nolog 'f'
X
X/***************************************************************************
V**************************************
X
X Program :`009QUOTA`009`009Return a user's disk quotas
X Module`009:`009QUOTA.C`009`009(the root)
X Author`009:`009Nick de Smith`009January, 1990
X`009`009Applied Telematics Services, 7 Vale Avenue, Tunbridge Wells, Kent TN
V1 1DJ, England.
X
X Copyright (c) 1990 by Applied Telematics Group Limited and Nick de Smith.
X This software is supplied for information only. No guarantee is supplied fo
Vr this software, and no liability
X will be accepted for any action resulting from the use of this software or
V the information contained herein.
X Under no circumstances may this software be used for commercial gain, inclu
Vding its sale, lease or loan.
X This software may be copied only with the inclusion of this copyright notic
Ve.
X The author is prepared to enter into correspondance with interested parties
V, but will not necessarily
X maintain this software. Having said all that, enjoy it!
X
X Description :
X
X Return the diskquota information for a user in DCL local string symbols:
X
X`009DISKQ_INUSE`009`009Symbol for inuse blocks
X`009DISKQ_PERMQUOTA`009`009Symbol for permanent quota
X`009DISKQ_OVERDRAFT`009`009Symbol for overdraft blocks
X
XFormat:
X
X`009$ QUOTA`009= "disk:`091dir`093QUOTA"
X`009$!
X`009$ QUOTA`009username`009`009`009! Quota for "username" on their default d
Vevice
X or`009$ QUOTA`009dev:username`009`009`009! Quota for "username" on device "
Vdev"
X
X Edit`009Edit date`009By`009Why
X  01`00919-Jan-90`009NMdS`009DECUS version
X
X****************************************************************************
V*************************************/
X
X#module`009QUOTA`009"V1.01"
X
X#include`009descrip`009`009`009`009`009`009`009/* VMS descriptors`009`009`00
V9*/
X#include`009fibdef`009`009`009`009`009`009`009/* File block definitions`009`
V009*/
X#include`009iodef`009`009`009`009`009`009`009/* I/O function codes`009`009`0
V09*/
X#include`009ssdef`009`009`009`009`009`009`009/* VMS status values`009`009`00
V9*/
X#include`009stsdef`009`009`009`009`009`009`009/* VMS status value flags`009`
V009*/
X
X#include`009"uaidef.h"`009`009`009`009`009`009/* $GETUAI definitions`009`009
V`009*/
X#include`009"uafdef.h"`009`009`009`009`009`009/* SYSUAF.DAT field definition
Vs`009`009*/
X#include`009"dqfdef.h"`009`009`009`009`009`009/* Disk quota record definitio
Vns`009*/
X
Xstatic readonly $DESCRIPTOR( x_inuse`009, "DISKQ_INUSE" );`009`009/* Symbol
V for inuse blocks`009`009*/
Xstatic readonly $DESCRIPTOR( x_permquota, "DISKQ_PERMQUOTA" );`009`009/* Sym
Vbol for permanent quota`009`009*/
Xstatic readonly $DESCRIPTOR( x_overdraft, "DISKQ_OVERDRAFT" );`009`009/* Sym
Vbol for overdraft blocks`009`009*/
X
Xtypedef struct DQF `123`009`009`009`009`009`009`009/* Disk quota record`009`
V009`009*/
X`009unsigned long dqf$l_flags;
X`009unsigned long dqf$l_uic;
X`009unsigned long dqf$l_usage;
X`009unsigned long dqf$l_permquota;
X`009unsigned long dqf$l_overdraft;
X`125 DQF, *DQF_PTR;
X
Xtypedef struct ITMLST `123
X`009unsigned`009w_length`009: 16;
X`009unsigned`009w_item`009`009: 16;
X`009unsigned`009a_bufadr`009: 32;
X`009unsigned`009a_retlen`009: 32;
X`125 ITMLST, *ITMLST_PTR;
X
X#define`009ss_check( command ) `123`009\
X`009int ss_check_status = (command); \
X`009if ( (ss_check_status & STS$M_SUCCESS) == 0 ) `123 \
X`009`009return ss_check_status;`009\
X`009`125`009`009`009\
X`125;
X
X`012
X
X/***************************************************************************
V**************************************
X
X`009`009`009`009`009D I S K _ Q U O T A
X
X Return disk quota usage for the selected user on their default disk.
X
X****************************************************************************
V*************************************/
X
Xstatic`009DQF`009r_dqf;
Xstatic`009struct`009fibdef1`009r_fib;
X
XDISK_QUOTA()
X`123
X`009short`009w_chan;`009`009`009`009`009`009`009/* Channel to disk`009`009`0
V09*/
X`009short`009q_iosb`091 4 `093;`009`009`009`009`009`009/* $QIO I/O status bl
Vock`009`009*/
X`009long`009temp;`009`009`009`009`009`009`009/* Scratch variable`009`009`009
V*/
X
X`009struct dsc$descriptor_s x_dqf = `123`009`009`009`009/* Disk quota file r
Vecord`009`009*/
X`009`009DQF$K_LENGTH, DSC$K_DTYPE_T, DSC$K_CLASS_S, &r_dqf `125;
X`009struct dsc$descriptor_s x_fib = `123`009`009`009`009/* File information
V block record`009*/
X`009`009sizeof( r_fib ), DSC$K_DTYPE_T, DSC$K_CLASS_S, &r_fib `125;
X
X`009char`009t_defdev`091 UAF$S_DEFDEV `093;`009`009`009`009/* Name of user's
V default device`009*/
X`009struct dsc$descriptor_s x_defdev = `123`009`009`009`009/* Descriptor for
V device`009`009*/
X`009`009UAF$S_DEFDEV, DSC$K_DTYPE_T, DSC$K_CLASS_S, t_defdev `125;
X
X`009ITMLST`009r_getuai_itmlst`091`093 = `123`009`009`009`009`009/* $GETUAI i
Vtem list (no disk info)`009*/
X`009`009`123 sizeof( long ), UAI$_UIC   , &r_dqf.dqf$l_uic`009, 0 `125,`009/
V* Return user's UIC`009`009`009*/
X`009`009`123 0, 0, 0, 0 `125`009`009`009`009`009`009/* End of list`009`009`0
V09`009*/
X`009`125;
X`009ITMLST`009r_getuai_itmlst_d`091`093 = `123`009`009`009`009`009/* $GETUAI
V item list (with disk info)`009*/
X`009`009`123 UAF$S_DEFDEV`009, UAI$_DEFDEV, t_defdev`009`009, 0 `125,`009/*
V Return user's default device`009`009*/
X`009`009`123 sizeof( long ), UAI$_UIC   , &r_dqf.dqf$l_uic`009, 0 `125,`009/
V* Return user's UIC`009`009`009*/
X`009`009`123 0, 0, 0, 0 `125`009`009`009`009`009`009/* End of list`009`009`0
V09`009*/
X`009`125;
X`009static readonly $DESCRIPTOR( x_prompt, "_Username: " );`009`009/* Prompt
V to use`009`009`009*/
X`009static readonly $DESCRIPTOR( x_colon, ":" );`009`009`009/* Colon for dev
Vice name separator`009*/
X`009struct dsc$descriptor_d x_username = `123`009`009`009`009/* User name to
V check for`009`009*/
X`009`0090, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 `125;
X
X`009ss_check( LIB$GET_FOREIGN(`009`009`009`009`009/* Read command line`009`0
V09`009*/
X`009`009&x_username`009,`009`009`009`009`009/* Returned user name`009`009`00
V9*/
X`009`009&x_prompt`009,`009`009`009`009`009/* Prompt string to use`009`009`00
V9*/
X`009`0090`009`009,`009`009`009`009`009/* Resultant length not needed`009`009
V*/
X`009`0090`009`009) )`009`009`009`009`009/* Prompt only if needed`009`009*/
X
X`009temp = STR$FIND_FIRST_IN_SET(`009`009`009`009`009/* Look for device name
V`009`009`009*/
X`009`009&x_username`009,`009`009`009`009`009/* Search parameter string for..
V.`009*/
X`009`009&x_colon`009);`009`009`009`009`009/* ...delimiter string (":")`009`0
V09*/
X`009if ( temp != 0 ) `123`009`009`009`009`009`009/* If we found a device nam
Ve...`009`009*/
X`009`009ss_check( STR$LEFT(`009`009`009`009`009/* ...extract the device name
V`009`009*/
X`009`009`009&x_defdev`009,`009`009`009`009/* ...into the device name descrip
Vtor`009*/
X`009`009`009&x_username`009,`009`009`009`009/* ...from the parameter line`00
V9`009*/
X`009`009`009&temp`009`009) )`009`009`009`009/* ...and include the ":"`009`00
V9*/
X
X`009`009temp++;`009`009`009`009`009`009`009/* Move past the ":"`009`009`009*
V/
X`009`009ss_check( STR$RIGHT(`009`009`009`009`009/* ...lose device name from
V username`009*/
X`009`009`009&x_username`009,`009`009`009`009/* ...where to put user name`009
V`009*/
X`009`009`009&x_username`009,`009`009`009`009/* ...from the parameter line`00
V9`009*/
X`009`009`009&temp`009`009) )`009`009`009`009/* ...and omit the ":"`009`009`0
V09*/
X
X`009`009ss_check( SYS$GETUAI(`009`009`009`009`009/* Get information on user`
V009`009*/
X`009`009`0090`009`009,
X`009`009`0090`009`009,
X`009`009`009&x_username`009,`009`009`009`009/* Return information for this u
Vser`009*/
X`009`009`009r_getuai_itmlst`009,`009`009`009`009/* No disk info, just UIC`00
V9`009*/
X`009`009`0090`009`009,
X`009`009`0090`009`009,
X`009`009`0090`009`009) )
X
X`009`125 else `123
X`009`009ss_check( SYS$GETUAI(`009`009`009`009`009/* Get information on user`
V009`009*/
X`009`009`0090`009`009,
X`009`009`0090`009`009,
X`009`009`009&x_username`009,`009`009`009`009/* Return information for this u
Vser`009*/
X`009`009`009r_getuai_itmlst_d,`009`009`009`009/* Include disk information`00
V9`009*/
X`009`009`0090`009`009,
X`009`009`0090`009`009,
X`009`009`0090`009`009) )
X`009`009x_defdev.dsc$w_length = (unsigned short) t_defdev`091 0 `093;`009/*
V First byte is length`009`009`009*/
X`009`009x_defdev.dsc$a_pointer= &t_defdev`091 1 `093;
X
X`009`125
X`009ss_check( SYS$ASSIGN(`009`009`009`009`009`009/* Assign a channel to the
V disk`009`009*/
X`009`009&x_defdev`009,`009`009`009`009`009/* Name of disk to use`009`009`009
V*/
X`009`009&w_chan`009`009,`009`009`009`009`009/* Returned channel to disk ACP`
V009`009*/
X`009`0090`009`009,
X`009`0090`009`009) )
X
X`009r_fib.fib$w_cntrlfunc = FIB$C_EXA_QUOTA;`009`009`009/* Say we want to ex
Vamine disk quotas`009*/
X
X`009ss_check( SYS$QIOW(`009`009`009`009`009`009/* Ask the ACp for disk quoat
Va info`009*/
X`009`0090`009`009,`009`009`009`009`009/* Event flag number`009`009`009*/
X`009`009w_chan`009`009,`009`009`009`009`009/* Channel to ACP`009`009`009*/
X`009`009IO$_ACPCONTROL`009,`009`009`009`009`009/* Ask ACP for control inform
Vation`009*/
X`009`009q_iosb`009`009,`009`009`009`009`009/* I/O status block`009`009`009*/
X`009`0090`009`009,`009`009`009`009`009/* AST address (not used)`009`009*/
X`009`0090`009`009,`009`009`009`009`009/* AST parameter (not used)`009`009*/
X`009`009&x_fib`009`009,`009`009`009`009`009/* P1 - request block`009`009`009
V*/
X`009`009&x_dqf`009`009,`009`009`009`009`009/* P2 - input DQF record`009`009*
V/
X`009`0090`009`009,`009`009`009`009`009/* P3 -`009`009`009`009`009*/
X`009`009&x_dqf`009`009,`009`009`009`009`009/* P4 - output DQF record`009`009
V*/
X`009`0090`009`009,`009`009`009`009`009/* P5 -`009`009`009`009`009*/
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-
