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 |
30 |
|
#ifdef __cplusplus |
31 |
|
extern "C" { |
32 |
|
#endif |
33 |
+ |
/* identify header lines */ |
34 |
+ |
#define MAXFMTLEN 64 |
35 |
+ |
#define isheadid(s) headidval(NULL,s) |
36 |
+ |
#define isformat(s) formatval(NULL,s) |
37 |
+ |
#define isdate(s) dateval(NULL,s) |
38 |
+ |
#define isgmt(s) gmtval(NULL,s) |
39 |
+ |
|
40 |
+ |
#define LATLONSTR "LATLONG=" |
41 |
+ |
#define LLATLONSTR 8 |
42 |
+ |
#define islatlon(hl) (!strncmp(hl,LATLONSTR,LLATLONSTR)) |
43 |
+ |
#define latlonval(ll,hl) sscanf((hl)+LLATLONSTR, "%f %f", \ |
44 |
+ |
&(ll)[0],&(ll)[1]) |
45 |
+ |
#define fputlatlon(lat,lon,fp) fprintf(fp,"%s %.6f %.6f\n",LATLONSTR,lat,lon) |
46 |
+ |
/* defined in header.c */ |
47 |
+ |
extern void newheader(const char *t, FILE *fp); |
48 |
+ |
extern int headidval(char *r, const char *s); |
49 |
+ |
extern int dateval(time_t *t, const char *s); |
50 |
+ |
extern int gmtval(time_t *t, const char *s); |
51 |
+ |
extern void fputdate(time_t t, FILE *fp); |
52 |
+ |
extern void fputnow(FILE *fp); |
53 |
+ |
extern void printargs(int ac, char **av, FILE *fp); |
54 |
+ |
extern int formatval(char fmt[MAXFMTLEN], const char *s); |
55 |
+ |
extern void fputformat(const char *s, FILE *fp); |
56 |
+ |
typedef int gethfunc(char *s, void *p); /* callback to process header lines */ |
57 |
+ |
extern int getheader(FILE *fp, gethfunc *f, void *p); |
58 |
+ |
extern int globmatch(const char *pat, const char *str); |
59 |
+ |
extern int checkheader(FILE *fin, char fmt[MAXFMTLEN], FILE *fout); |
60 |
|
/* defined in badarg.c */ |
61 |
|
extern int badarg(int ac, char **av, char *fl); |
62 |
|
/* defined in expandarg.c */ |