From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 12-SEP-1989 06:53
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Re: Disk Quota

Message-Id:  <8909121048.AA17461@crdgw1.ge.com>
Received: From CUNYVM.CUNY.EDU by CRVAX.SRI.COM with TCP; Tue, 12 SEP 89 03:05:08 PDT
Received: from IRLEARN.UCD.IE by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 8973; Tue, 12 Sep 89 06:05:37 EDT
Received: from ccvax.ucd.ie by IRLEARN.UCD.IE (Mailer R2.03B) with BSMTP id
 3180; Tue, 12 Sep 89 10:32:22 GMT
Received: from vms.eurokom.ie by ccvax.ucd.ie; Tue, 12 Sep 89 10:27 GMT
Date: Tue, 12 Sep 89 11:28 CET
From: John O'Connor EuroKom <JOCONNOR%vms.eurokom.ie@CUNYVM.CUNY.EDU>
Subject: Re: Disk Quota
To: info-vax@kl.sri.com
X-Vms-To: in%"info-vax@kl.sri.com"

Path: kom!joconnor
From: joconnor@vms.eurokom.ie (John O'Connor EuroKom)
Newsgroups: ucd.info-vax
Subject: Re: Disk Quota
Message-ID: <3034@vms.eurokom.ie>
Date: 12 Sep 89 11:28:25 GMT
References: <3014@vms.eurokom.ie>
Organization: EuroKom Conferencing Service
Lines: 118

In article <3014@vms.eurokom.ie>, Roland Schemers <mailrus!egrunix!schemers@TUT.
   CIS.OHIO-STATE.edu> writes:
> Hello. Is there a way to get a person's disk quota using a run time
> library call? I am writing a program that add classes automatically,
> and I need to find out how much disk quota a person already has allocated
> to them.
>

It can be done using SYS$QIOW calls and the ACP function codes in chapter I
of the I/O manual. I enclose a C program example that I messaed around with
once.

#include <stdio.h>
#include <stdlib.h>
#include <ssdef.h>
#include <descrip.h>
#include <rms.h>
#include <iodef.h>
#include <fibdef.h>
struct  dsc$descriptor_b
        {
        unsigned short  dsc$w_length;   /* specific to descriptor class;  typica
lly a 16-b
   it (unsigned) length */
        unsigned char   dsc$b_dtype;    /* data type code */
        unsigned char   dsc$b_class;    /* descriptor class code */
        char     *dsc$a_pointer;        /* address of first byte of data element
 */
        };

#define $BDESCRIPTOR(name,block)        struct dsc$descriptor_s name = { (sizeof
(block)
   ), DSC$K_DTYPE_T, DSC$K_CLASS_S, &block }

struct uic_template
{
        long flags;
        union
        {
          short w[2];
          long l;
        } uic;
        long current;
        long permanent;
        long overdraft;
        long reserved[3];
};
struct iosb_t
{
        short cond,cnt;
        long devint;
} iosb;
long len;
struct uic_template src_uic,dst_uic;
struct fibdef1 fib = NULL;
char volnam[] = "SYS$SYSDEVICE:";

$BDESCRIPTOR(d_src_uic,src_uic);        /* to describe user name */
$BDESCRIPTOR(d_dst_uic,dst_uic);        /* to describe user name */
$BDESCRIPTOR(d_fib,fib);        /* to describe user name */
$DESCRIPTOR(d_volnam,volnam);   /* to describe user name */

int f_get_uic_block()
{
        short chan;
        long status;
        int sys$qiow(),sys$assign();
        fib.fib$w_cntrlfunc = FIB$C_EXA_QUOTA;

        status = sys$assign(&d_volnam,&chan,0,0);
        if (!(status%2)) return(status);
        status = sys$qiow(0,chan,IO$_ACPCONTROL,&iosb,
                          0,0,&d_fib,&d_src_uic,&len,&d_dst_uic,0,0);
        return(status);
}

char strbuff[500];
char faostr[] = " User !%I has !ZL blocks used!/\
 of !ZL authorised and permitted overdraft of !ZL blocks.!/";

$DESCRIPTOR (d_buff,strbuff);
$DESCRIPTOR (d_fao,faostr);

main()
{
        int sys$fao(),status,f_get_uic_block();
        char dummy[2];
        printf ("Enter UIC : ");
        while (scanf("[%ho,%ho",&src_uic.uic.w[1],&src_uic.uic.w[0]) != EOF)
        {
                gets(&dummy);           /* discard rest of buffer */
                status = f_get_uic_block();
                if (!(iosb.cond%2))
                        lib$signal(iosb.cond);
                else if (!(status%2))
                        lib$signal(status);
                else
                {
                        status = sys$fao(&d_fao,&len,&d_buff,src_uic.uic.l,
                                        dst_uic.current,dst_uic.permanent,
                                        dst_uic.overdraft);
                        if (!(status%2))
                                lib$signal(status);
                        else
                        {
                                strbuff[len] = 0;
                                printf("%s",strbuff);
                        };
                };
                printf ("Enter UIC : ");
        }
}

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 John O'Connor,                <{}>    Internet:   joconnor@vms.eurokom.ie
 Systems Support,               ><     Bitnet:     JOCONNOR@CCVAX.BITNET
 EuroKom,                      <{}>
 University College Dublin,     ><     EuroKom:    John_O_Connor@eurokom.ie
 Dublin 4,                     <{}>    PSI:        027243159000637::JOCONOR
 Ireland.                       ><
                               <{}>    Fax:        +353.1.838605
                                ><     Phone:      +353.1.697890
                               <{}>    Telex:      (0500) 91178 UCD EI
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

