|
|
1.1 ! root 1: /* ! 2: * static char ID_ldfcnh[] = "@(#) ldfcn.h: 1.3 5/1/83"; ! 3: */ ! 4: ! 5: /* ! 6: * The following two declarations appear in the IH versions of ! 7: * "stdio.h" but do not appear in the normal 1.2 versions. ! 8: */ ! 9: ! 10: long ftell(); ! 11: char *fgets(); ! 12: ! 13: #ifndef LDFILE ! 14: struct ldfile { ! 15: int _fnum_; /* so each instance of an LDFILE is unique */ ! 16: FILE *ioptr; /* system I/O pointer value */ ! 17: long offset; /* absolute offset to the start of the file */ ! 18: FILHDR header; /* the file header of the opened file */ ! 19: unsigned short type; /* indicator of the type of the file */ ! 20: }; ! 21: ! 22: ! 23: /* ! 24: provide a structure "type" definition, and the associated ! 25: "attributes" ! 26: */ ! 27: ! 28: #define LDFILE struct ldfile ! 29: #define IOPTR(x) x->ioptr ! 30: #define OFFSET(x) x->offset ! 31: #define TYPE(x) x->type ! 32: #define HEADER(x) x->header ! 33: #define LDFSZ sizeof(LDFILE) ! 34: ! 35: /* ! 36: define various values of TYPE(ldptr) ! 37: */ ! 38: ! 39: #define LDTYPE B16MAGIC /* defined in terms of the filehdr.h include file */ ! 40: #define TVTYPE TVMAGIC /* ditto */ ! 41: #if u3b5 ! 42: #define USH_ARTYPE ARTYPE ! 43: #else ! 44: #define USH_ARTYPE (unsigned short) ARTYPE ! 45: #endif ! 46: #if defined(PORTAR) || defined(PORT5AR) ! 47: #define ARTYPE 0177545 ! 48: #else ! 49: #define ARTYPE ARMAG ! 50: #endif ! 51: ! 52: /* ! 53: define symbolic positioning information for FSEEK (and fseek) ! 54: */ ! 55: ! 56: #define BEGINNING 0 ! 57: #define CURRENT 1 ! 58: #define END 2 ! 59: ! 60: /* ! 61: define a structure "type" for an archive header ! 62: */ ! 63: ! 64: #if defined(PORTAR) || defined(PORT5AR) ! 65: typedef struct ! 66: { ! 67: char ar_name[16]; ! 68: long ar_date; ! 69: int ar_uid; ! 70: int ar_gid; ! 71: long ar_mode; ! 72: long ar_size; ! 73: } archdr; ! 74: ! 75: #define ARCHDR archdr ! 76: #else ! 77: #define ARCHDR struct ar_hdr /* ARCHIVE is defined in ts.h */ ! 78: #endif ! 79: #define ARCHSZ sizeof(ARCHDR) ! 80: ! 81: ! 82: /* ! 83: define some useful symbolic constants ! 84: */ ! 85: ! 86: #define SYMTBL 0 /* section nnumber and/or section name of the Symbol Table */ ! 87: ! 88: #define SUCCESS 1 ! 89: #define CLOSED 1 ! 90: #define FAILURE 0 ! 91: #define NOCLOSE 0 ! 92: #define BADINDEX -1L ! 93: ! 94: #define OKFSEEK 0 ! 95: ! 96: /* ! 97: define macros to permit the direct use of LDFILE pointers with the ! 98: standard I/O library procedures ! 99: */ ! 100: ! 101: LDFILE *ldopen(); ! 102: LDFILE *ldaopen(); ! 103: ! 104: #define GETC(ldptr) getc(IOPTR(ldptr)) ! 105: #define GETW(ldptr) getw(IOPTR(ldptr)) ! 106: #define FEOF(ldptr) feof(IOPTR(ldptr)) ! 107: #define FERROR(ldptr) ferror(IOPTR(ldptr)) ! 108: #define FGETC(ldptr) fgetc(IOPTR(ldptr)) ! 109: #define FGETS(s,n,ldptr) fgets(s,n,IOPTR(ldptr)) ! 110: #define FILENO(ldptr) fileno(IOPTR(ldptr)) ! 111: #define FREAD(p,s,n,ldptr) fread(p,s,n,IOPTR(ldptr)) ! 112: #define FSEEK(ldptr,o,p) fseek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr)+o):o,p) ! 113: #define FTELL(ldptr) ftell(IOPTR(ldptr)) ! 114: #define FWRITE(p,s,n,ldptr) fwrite(p,s,n,IOPTR(ldptr)) ! 115: #define REWIND(ldptr) rewind(IOPTR(ldptr)) ! 116: #define SETBUF(ldptr,b) setbuf(IOPTR(ldptr),b) ! 117: #define UNGETC(c,ldptr) ungetc(c,IOPTR(ldptr)) ! 118: #define STROFFSET(ldptr) (HEADER(ldptr).f_symptr + HEADER(ldptr).f_nsyms * 18) /* 18 == SYMESZ */ ! 119: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.