-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfields.h
23 lines (21 loc) · 875 Bytes
/
fields.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define MAXLEN 1001
#define MAXFIELDS 1000
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
typedef struct inputstruct {
char *name; /* File name */
FILE *f; /* File descriptor */
int line; /* Line number */
char text1[MAXLEN]; /* The line */
char text2[MAXLEN]; /* Working -- contains fields */
int NF; /* Number of fields */
char *fields[MAXFIELDS]; /* Pointers to fields */
int file; /* 1 for file, 0 for popen */
} *IS;
extern IS new_inputstruct(char*);
extern IS pipe_inputstruct(char*);
extern int get_line(IS); /* returns NF, or -1 on EOF. Does not
close the file */
extern void jettison_inputstruct(IS); /* frees the IS and fcloses
the file */