10 |
|
#include <sys/types.h> |
11 |
|
#include <fcntl.h> |
12 |
|
#include <string.h> |
13 |
+ |
#include <time.h> |
14 |
|
|
15 |
+ |
#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ |
16 |
+ |
#undef getc |
17 |
+ |
#undef getchar |
18 |
+ |
#undef putc |
19 |
+ |
#undef putchar |
20 |
+ |
#undef feof |
21 |
+ |
#undef ferror |
22 |
+ |
#define getc getc_unlocked |
23 |
+ |
#define getchar getchar_unlocked |
24 |
+ |
#define putc putc_unlocked |
25 |
+ |
#define putchar putchar_unlocked |
26 |
+ |
#ifndef __cplusplus |
27 |
+ |
#define feof feof_unlocked |
28 |
+ |
#define ferror ferror_unlocked |
29 |
+ |
#endif |
30 |
+ |
#endif |
31 |
+ |
|
32 |
|
#ifdef __cplusplus |
33 |
|
extern "C" { |
34 |
|
#endif |
35 |
+ |
/* identify header lines */ |
36 |
+ |
#define MAXFMTLEN 64 |
37 |
+ |
#define isheadid(s) headidval(NULL,s) |
38 |
+ |
#define isformat(s) formatval(NULL,s) |
39 |
+ |
#define isdate(s) dateval(NULL,s) |
40 |
+ |
#define isgmt(s) gmtval(NULL,s) |
41 |
|
|
42 |
< |
/* XXX include paths.h instead */ |
43 |
< |
#ifndef F_OK /* mode bits for access(2) call */ |
44 |
< |
#define R_OK 4 /* readable */ |
45 |
< |
#define W_OK 2 /* writable */ |
46 |
< |
#define X_OK 1 /* executable */ |
47 |
< |
#define F_OK 0 /* exists */ |
48 |
< |
#endif |
49 |
< |
|
42 |
> |
#define LATLONSTR "LATLONG=" |
43 |
> |
#define LLATLONSTR 8 |
44 |
> |
#define islatlon(hl) (!strncmp(hl,LATLONSTR,LLATLONSTR)) |
45 |
> |
#define latlonval(ll,hl) sscanf((hl)+LLATLONSTR, "%f %f", \ |
46 |
> |
&(ll)[0],&(ll)[1]) |
47 |
> |
#define fputlatlon(lat,lon,fp) fprintf(fp,"%s %.6f %.6f\n",LATLONSTR,lat,lon) |
48 |
> |
/* defined in header.c */ |
49 |
> |
extern void newheader(const char *t, FILE *fp); |
50 |
> |
extern int headidval(char *r, const char *s); |
51 |
> |
extern int dateval(time_t *t, const char *s); |
52 |
> |
extern int gmtval(time_t *t, const char *s); |
53 |
> |
extern void fputdate(time_t t, FILE *fp); |
54 |
> |
extern void fputnow(FILE *fp); |
55 |
> |
extern void printargs(int ac, char **av, FILE *fp); |
56 |
> |
extern int formatval(char fmt[MAXFMTLEN], const char *s); |
57 |
> |
extern void fputformat(const char *s, FILE *fp); |
58 |
> |
typedef int gethfunc(char *s, void *p); /* callback to process header lines */ |
59 |
> |
extern int getheader(FILE *fp, gethfunc *f, void *p); |
60 |
> |
extern int globmatch(const char *pat, const char *str); |
61 |
> |
extern int checkheader(FILE *fin, char fmt[MAXFMTLEN], FILE *fout); |
62 |
|
/* defined in badarg.c */ |
63 |
|
extern int badarg(int ac, char **av, char *fl); |
64 |
|
/* defined in expandarg.c */ |
65 |
+ |
extern int envexpchr, filexpchr; |
66 |
|
extern int expandarg(int *acp, char ***avp, int n); |
67 |
|
/* defined in fdate.c */ |
68 |
|
extern time_t fdate(char *fname); |
70 |
|
/* defined in fgetline.c */ |
71 |
|
extern char *fgetline(char *s, int n, FILE *fp); |
72 |
|
/* defined in fgetval.c */ |
73 |
< |
extern int fgetval(FILE *fp, int ty, char *vp); |
73 |
> |
extern int fgetval(FILE *fp, int ty, void *vp); |
74 |
|
/* defined in fgetword.c */ |
75 |
|
extern char *fgetword(char *s, int n, FILE *fp); |
76 |
|
/* defined in fputword.c */ |
77 |
|
extern void fputword(char *s, FILE *fp); |
41 |
– |
/* defined in fixargv0.c */ |
42 |
– |
/*extern char *fixargv0(char *av0);*/ /* XXX include paths.h instead */ |
78 |
|
/* defined in fropen.c */ |
79 |
|
extern FILE *frlibopen(char *fname); |
80 |
|
/* defined in getlibpath.c */ |
81 |
|
extern char *getrlibpath(void); |
82 |
+ |
/* defined in gethomedir.c */ |
83 |
+ |
extern char *gethomedir(char *uname, char *path, int plen); |
84 |
|
/* defined in getpath.c */ |
85 |
|
extern char *getpath(char *fname, char *searchpath, int mode); |
86 |
+ |
/* defined in byteswap.c */ |
87 |
+ |
extern void swap16(char *wp, int n); |
88 |
+ |
extern void swap32(char *wp, int n); |
89 |
+ |
extern void swap64(char *wp, int n); |
90 |
|
/* defined in portio.c */ |
91 |
|
extern void putstr(char *s, FILE *fp); |
92 |
|
extern void putint(long i, int siz, FILE *fp); |
93 |
|
extern void putflt(double f, FILE *fp); |
94 |
+ |
extern int putbinary(const void *s, int elsiz, int nel, FILE *fp); |
95 |
|
extern char *getstr(char *s, FILE *fp); |
96 |
|
extern long getint(int siz, FILE *fp); |
97 |
|
extern double getflt(FILE *fp); |
98 |
+ |
extern int getbinary(void *s, int elsiz, int nel, FILE *fp); |
99 |
|
/* defined in rexpr.c */ |
100 |
|
extern int ecompile(char *sp, int iflg, int wflag); |
101 |
|
extern char *expsave(void); |
109 |
|
extern char *savqstr(char *s); |
110 |
|
extern void freeqstr(char *s); |
111 |
|
/* defined in wordfile.c */ |
112 |
< |
extern int wordfile(char **words, char *fname); |
113 |
< |
extern int wordstring(char **avl, char *str); |
112 |
> |
extern int wordfile(char **words, int nargs, char *fname); |
113 |
> |
extern int wordstring(char **avl, int nargs, char *str); |
114 |
|
/* defined in words.c */ |
115 |
|
extern char *atos(char *rs, int nb, char *s); |
116 |
|
extern char *nextword(char *cp, int nb, char *s); |
126 |
|
extern float * matchlamp(char *s); |
127 |
|
extern int loadlamps(char *file); |
128 |
|
extern void freelamps(void); |
129 |
+ |
|
130 |
+ |
#ifndef strlcpy /* defined in option strlcpy.c */ |
131 |
+ |
extern size_t strlcpy(char *dst, const char *src, size_t siz); |
132 |
+ |
extern size_t strlcat(char *dst, const char *src, size_t siz); |
133 |
+ |
#endif |
134 |
|
|
135 |
|
#ifdef __cplusplus |
136 |
|
} |