Article 130173 of comp.os.vms:
Path: nntpd.lkg.dec.com!crl.dec.com!crl.dec.com!bloom-beacon.mit.edu!gatech!news.mathworks.com!news.kei.com!simtel!lll-winken.llnl.gov!fnnews.fnal.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: MADGOAT FTP server - process quota exceeded
Date: 26 Sep 1995 00:01:59 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 57
Distribution: world
Message-ID: <447ftn$ri1@gap.cco.caltech.edu>
References: <DFDAxE.Gwr@carmen.logica.co.uk> <444gq1$he6@gap.cco.caltech.edu>,<DFGLsL.9uG@carmen.logica.co.uk>,<44773s$k9s@gap.cco.caltech.edu>
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu

In article <44773s$k9s@gap.cco.caltech.edu>, carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes:

Among other things, a program with an error in it.  Thanks to Dave Greenwood
<GREENWOODDE@FED.ORNL.GOV> for pointing out to me that I forgot to properly
terminate the item list in the program.  The declaration of itmlst SHOULD be
terminated with four zeros.  And, of course, if you want it to compile without
complaints from the DEC C compiler, the bufaddr fields in the other items
should be explicitly cast, and should point to static variables, so the program
should read:

#include jpidef
#define ckstat(x) if(((stat = x) & 7) != 1) SYS$EXIT(stat)
main(int nargs, char **args)
{	static unsigned long astcnt, biocnt, bytcnt, diocnt, enqcnt, filcnt,
		pagfilcnt, tqcnt;
	unsigned long pid, SYS$EXIT(), SYS$GETJPIW(), stat, iosb[2];
	void puts(), printf(), sscanf(), sprintf();

	struct ITEM_LIST_3
	{	unsigned short buflen, itmcod;
		unsigned long bufadr, rsladr;
	} itmlst[] = 
	{	{ 4, JPI$_ASTCNT, (long) &astcnt, 0 },
		{ 4, JPI$_BIOCNT, (long) &biocnt, 0 },
		{ 4, JPI$_BYTCNT, (long) &bytcnt, 0 },
		{ 4, JPI$_DIOCNT, (long) &diocnt, 0 },
		{ 4, JPI$_ENQCNT, (long) &enqcnt, 0 },
		{ 4, JPI$_FILCNT, (long) &filcnt, 0 },
		{ 4, JPI$_PAGFILCNT, (long) &pagfilcnt, 0 },
		{ 4, JPI$_TQCNT, (long) &tqcnt, 0 },
		{ 0, 0, 0, 0 }
	};
	char fmtstr[150];
	if (nargs != 2)
	{	puts("Usage: SHOWQUOTAS pid");
		SYS$EXIT(1);
	}
	sscanf(*++args, "%x", &pid);
	sprintf(fmtstr, "%s%s%s",
		"JPI$_ASTCNT=%d\nJPI$_BIOCNT=%d\nJPI$_BYTCNT=%d\n",
		"JPI$_DIOCNT=%d\nJPI$_ENQCNT=%d\nJPI$_FILCNT=%d\n",
		"JPI$_PAGFILCNT=%d\nJPI$_TQCNT=%d\n");
	while(1 == 1)
	{	ckstat(SYS$GETJPIW(0, &pid, 0, itmlst, iosb, 0, 0));
		ckstat(iosb[0]);
		printf(fmtstr, astcnt, biocnt, bytcnt, diocnt, enqcnt, filcnt,
			pagfilcnt, tqcnt);
	}
}
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.


