1: static  char sccsid[] = "@(#)old.c 4.2 8/17/82";
   2: /*
   3:  * sdb - a symbolic debugger for UNIX.
   4:  */
   5: 
   6: /*
   7:  * This file contains support routines for older versions of the system.
   8:  */
   9: 
  10: #ifndef VMUNIX
  11: /*
  12:  * These routines are used only if the system
  13:  * doesn't have virtual memory.  They
  14:  * are used only to read the symbol table, which
  15:  * is simply kept in VM on VMUNIX.
  16:  */
  17: #include <pagsiz.h>
  18: #include "bio.h"
  19: 
  20: bread(brs, buff, nbytes)
  21: struct brbuf *brs; char *buff; {
  22:     register int k, nb;
  23: 
  24:     if (nbytes > 0) {
  25:         for (nb=nbytes; nb>0; nb--) {
  26:             if (brs->nr == 0) {
  27:                 brs->nr = read(brs->fd, brs->next=brs->b, BSIZE);
  28:                 brs->nl = 0;
  29:                 if (brs->nr < 0) return(-1);
  30:                 if (brs->nr == 0) return(nbytes-nb);
  31:                 }
  32:             *buff++ = *brs->next++;
  33:             brs->nr--;
  34:             brs->nl++;
  35:             }
  36:         }
  37:     else {
  38:         nbytes = -nbytes;
  39:         for (nb=nbytes; nb>0; nb--) {
  40:             if (brs->nl == 0) {
  41:                 if ((k=tell(brs->fd)) >= BSIZE + brs->nr) {
  42:                     lseek(brs->fd, (long) -(BSIZE + brs->nr), 1);
  43:                     brs->nl = read(brs->fd, brs->b, BSIZE);
  44:                 } else {
  45:                     lseek(brs->fd, 0L, 0);
  46:                     k = k - brs->nr;
  47:                     if (k < 0) k = 0;
  48:                     brs->nl = read(brs->fd, brs->b, k);
  49:                 }
  50:                 if (brs->nl == 0) return(nbytes-nb);
  51:                 brs->next = brs->b + brs->nl;
  52:                 brs->nr = 0;
  53:                 }
  54:             *--buff = *--brs->next;
  55:             brs->nr++;
  56:             brs->nl--;
  57:             }
  58:         }
  59:     return(nbytes);
  60:     }
  61: 
  62: blseek(brs, offset, flag)
  63: struct brbuf *brs; long offset; {
  64:     brs->nl = 0;
  65:     brs->nr = 0;
  66:     return(lseek(brs->fd,offset,flag));
  67:     }
  68: 
  69: binit(brs)
  70: struct brbuf *brs; {
  71:     brs->nl = brs->nr = 0;
  72: }
  73: 
  74: long
  75: tell(fildes) {
  76:     return(lseek(fildes, 0L, 1));
  77: }
  78: #endif

Defined functions

binit defined in line 69; never used
blseek defined in line 62; never used
bread defined in line 20; never used
tell defined in line 74; used 1 times
  • in line 41

Defined variables

sccsid defined in line 1; never used
Last modified: 1982-10-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 879
Valid CSS Valid XHTML 1.0 Strict