1: # include   <ingres.h>
   2: # include   <access.h>
   3: # include   <sccs.h>
   4: 
   5: SCCSID(@(#)formatpg.c	8.2	2/8/85)
   6: 
   7: /*
   8: **	FORMATPG - write n pages to a buffer
   9: **
  10: **
  11: **	Parameters:
  12: **		d - descriptor
  13: **		n - number of pages
  14: **
  15: **
  16: **	Return Codes:
  17: **		0 - successful
  18: **		-2 - failure when setting file ptr
  19: **		-3, -4 - failure when writing page to buffer
  20: **			-4 is for last page
  21: **
  22: **	Called by:
  23: **		create()
  24: **		modify()
  25: **		resetrel()
  26: **
  27: */
  28: formatpg(d, n)
  29: DESC    *d;
  30: long    n;
  31: {
  32:     struct accbuf   buf;
  33:     register char   *p;
  34:     extern long lseek();
  35: 
  36:     if (Acc_head == 0)
  37:         acc_init();
  38:     if (lseek(d->relfp, 0l, 0) == -1)
  39:         return (-2);
  40:     buf.rel_tupid = d->reltid.ltid;
  41:     buf.filedesc = d->relfp;
  42:     for (p = (char *) &buf; p <= (char *) buf.linetab; p++)
  43:         *p = NULL;
  44:     buf.nxtlino = 0;
  45:     buf.linetab[0] = (int) buf.firstup - (int) &buf;
  46:     buf.ovflopg = 0;
  47:     for (buf.mainpg = 1; buf.mainpg < n; (buf.mainpg)++)
  48:     {
  49:         if (write(buf.filedesc, (char *) &buf, PGSIZE) != PGSIZE)
  50:             return (-3);
  51:     }
  52:     buf.mainpg = 0;
  53:     if (write(buf.filedesc, (char *) &buf, PGSIZE) != PGSIZE)
  54:         return (-4);
  55:     Accuwrite += n;
  56:     return (0);
  57: }

Defined functions

formatpg defined in line 5; never used
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 714
Valid CSS Valid XHTML 1.0 Strict