home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / finger / part01 / kmem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-03  |  1.5 KB  |  61 lines

  1. /*
  2.  * kmem.h -- interface to kmem.c
  3.  *
  4.  * Copyright (C) 1986, 1990  Philip L. Budne
  5.  *
  6.  * This file is part of "Phil's Finger Program".
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 1, or (at your option)
  11.  * any later version.
  12.  *
  13.  */
  14.  
  15. # define KMEM_RCSID "$Id: kmem.h,v 3.0 90/07/06 13:11:11 budd Rel $"
  16.  
  17. # if SunOS >= 400
  18. # include <kvm.h>
  19. # define FTYPE kvm_t *
  20. # define KMEMREAD(p,b,l) kvm_read(kmem, p, b, l)
  21. # define ISBADFILE(f) ((f) == NULL)
  22. # else  /* not SunOS >= 400 */
  23.  
  24. # define BUFIO 0        /* total lose */
  25.  
  26. # if BUFIO
  27. # define ISBADFILE(f) (f == NULL)
  28. # define BADFILE NULL
  29. # define FTYPE FILE *
  30. # define OPEN(n) fopen(n, "r")
  31. # define CLOSE(f) fclose(f)
  32. # define READ(f,buf,cnt) fread(buf,cnt,1,f)
  33. # define SEEK(f,o,w) fseek(f,o,w)
  34. # define FILENO(f) fileno(f)
  35. # else  /* not BUFIO */
  36. # define ISBADFILE(f) (f < 0)
  37. # define BADFILE -1
  38. # define FTYPE int
  39. # define CLOSE(f) close(f)
  40. # define OPEN(n) open(n, 0)
  41. # define READ(f,buf,cnt) read(f,buf,cnt)
  42. # define SEEK(f,o,w) lseek(f,o,w)
  43. # define FILENO(f) (f)
  44. # endif /* not BUFIO */
  45.  
  46. # ifdef sgi
  47. /* Bletch! remove K0BASE.  works for K0 and K2 addrs */
  48. # define KVADDR(p) (((unsigned long)(p)) & ~0x80000000 )
  49. # else  /* sgi not defined */
  50. # define KVADDR(p) (p)
  51. # endif /* sgi not defined */
  52.  
  53. # define KMEMREAD(p,b,l) kread(kmem, KVADDR(p), b, l)
  54. # endif /* not SunOS >= 400 */
  55.  
  56. /*
  57.  * Local variables:
  58.  * comment-column: 40
  59.  * End:
  60.  */
  61.