Article 153172 of comp.os.vms:
> Could anyone provide an example of using the IO$_ACPCONTROL function
> in a $QIO service call to add diskquota for a user to a disk?
> 
> Using DEC C V5.0-003 on OpenVMS Alpha V6.2
> 
> i have torn my hair out trying to figure out where all the pieces go
> when using this call/interface. i RTFM until my eyes dried out and my
> asprin bottle went dry.

Try this:

#include <stdio.h>
#include <descrip.h>
#include <prvdef.h>
#include <iodef.h>
#include <fibdef.h>
#include "dqfdef.h"

long sys$assign();
long sys$asctoid();
long sys$qiow();
long sys$dassgn();

long quoblck[DQF$C_LENGTH/sizeof(long)];
struct fibdef1 fibblck;

void add_disk_quota(struct dsc$descriptor_s *undesc,
                    struct dsc$descriptor_s *devdesc,
                    long permquota,long overdraft)
{
   long stat,iosb[2];
   short chan,dummy;
   long qdesc[2] = { sizeof(quoblck),(long)&quoblck };
   long fibdesc[2] = { sizeof(fibblck),(long)&fibblck };
   stat = sys$assign(devdesc,&chan,0,0);
   printf("%d\n",stat);
   fibblck.fib$w_cntrlfunc = FIB$C_ADD_QUOTA;
   stat = sys$asctoid(undesc,&quoblck[DQF$L_UIC/sizeof(long)],0);
   printf("%d\n",stat);
   quoblck[DQF$L_PERMQUOTA/sizeof(long)] = permquota;
   quoblck[DQF$L_OVERDRAFT/sizeof(long)] = overdraft;
   stat = sys$qiow(0,chan,IO$_ACPCONTROL,iosb,0,0,
                   &fibdesc,&qdesc,&dummy,&qdesc,0,0);
   printf("%d\n",stat);
   printf("%d\n",iosb[0]);
   stat = sys$dassgn(chan);
   printf("%d\n",stat);
   return;
}

main()
{
   $DESCRIPTOR(undesc,"ARNE");
   $DESCRIPTOR(devdesc,"DISK5");
   add_disk_quota(&undesc,&devdesc,10000,1000);
}

DQFDEF.H:

/* 
 *                              DQFDEF.H
 * 
 *  Definitions created by VAXC_DEFS at 30-MAY-1993 16:12:27.50
 */
#define DQF$M_ACTIVE 1
#define DQF$K_LENGTH 32
#define DQF$C_LENGTH 32
#define DQF$S_DQFDEF 32
#define DQF$L_FLAGS 0
#define DQF$V_ACTIVE 0
#define DQF$L_UIC 4
#define DQF$L_USAGE 8
#define DQF$L_PERMQUOTA 12
#define DQF$L_OVERDRAFT 16
/* 
 *  End of VAXC_DEFS definitions
 */



                                                          Arne

Arne Vajhøj                             local DECNET:  KOPC::ARNE
Computer Department                     PSI:           PSI%23831001354030::ARNE
Southern Denmark Business School        Internet:      ARNE@KO.HHS.DK
                WWW URL: http://www.hhs.dk/~arne/arne.html



