|
|
1.1 root 1: #ident "@(#)/usr/include/ldfcn.h.sl 1.2 4.1 09/02/86 39906 AT&T-SF"
2:
3: #ifndef LDFILE
4: struct ldfile {
5: int _fnum_; /* so each instance of an LDFILE is unique */
6: FILE *ioptr; /* system I/O pointer value */
7: long offset; /* absolute offset to the start of the file */
8: FILHDR header; /* the file header of the opened file */
9: unsigned short type; /* indicator of the type of the file */
10: };
11:
12:
13: /*
14: provide a structure "type" definition, and the associated
15: "attributes"
16: */
17:
18: #define LDFILE struct ldfile
19: #define IOPTR(x) x->ioptr
20: #define OFFSET(x) x->offset
21: #define TYPE(x) x->type
22: #define HEADER(x) x->header
23: #define LDFSZ sizeof(LDFILE)
24:
25: /*
26: define various values of TYPE(ldptr)
27: */
28:
29: #define ARTYPE 0177545
30:
31: /*
32: define symbolic positioning information for FSEEK (and fseek)
33: */
34:
35: #define BEGINNING 0
36: #define CURRENT 1
37: #define END 2
38:
39: /*
40: define a structure "type" for an archive header
41: */
42:
43: typedef struct
44: {
45: char ar_name[16];
46: long ar_date;
47: int ar_uid;
48: int ar_gid;
49: long ar_mode;
50: long ar_size;
51: } archdr;
52:
53: #define ARCHDR archdr
54: #define ARCHSZ sizeof(ARCHDR)
55:
56:
57: /*
58: define some useful symbolic constants
59: */
60:
61: #define SYMTBL 0 /* section nnumber and/or section name of the Symbol Table */
62:
63: #define SUCCESS 1
64: #define CLOSED 1
65: #define FAILURE 0
66: #define NOCLOSE 0
67: #define BADINDEX -1L
68:
69: #define OKFSEEK 0
70:
71: /*
72: define macros to permit the direct use of LDFILE pointers with the
73: standard I/O library procedures
74: */
75:
76: LDFILE *ldopen();
77: LDFILE *ldaopen();
78:
79: #define GETC(ldptr) getc(IOPTR(ldptr))
80: #define GETW(ldptr) getw(IOPTR(ldptr))
81: #define FEOF(ldptr) feof(IOPTR(ldptr))
82: #define FERROR(ldptr) ferror(IOPTR(ldptr))
83: #define FGETC(ldptr) fgetc(IOPTR(ldptr))
84: #define FGETS(s,n,ldptr) fgets(s,n,IOPTR(ldptr))
85: #define FILENO(ldptr) fileno(IOPTR(ldptr))
86: #define FREAD(p,s,n,ldptr) fread(p,s,n,IOPTR(ldptr))
87: #define FSEEK(ldptr,o,p) fseek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr)+o):o,p)
88: #define FTELL(ldptr) ftell(IOPTR(ldptr))
89: #define FWRITE(p,s,n,ldptr) fwrite(p,s,n,IOPTR(ldptr))
90: #define REWIND(ldptr) rewind(IOPTR(ldptr))
91: #define SETBUF(ldptr,b) setbuf(IOPTR(ldptr),b)
92: #define UNGETC(c,ldptr) ungetc(c,IOPTR(ldptr))
93: #define STROFFSET(ldptr) (HEADER(ldptr).f_symptr + HEADER(ldptr).f_nsyms * 18) /* 18 == SYMESZ */
94: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.