26 |
*/ |
*/ |
27 |
int pos = 0; |
int pos = 0; |
28 |
#define GETC(x) (pos++,getc(x)) |
#define GETC(x) (pos++,getc(x)) |
29 |
read_some(buf,n,start_ch,copy) |
int |
30 |
|
read_some(char *buf, int n, int start_ch, int copy) |
31 |
/* if copy is not 0 then copy characters to stdout while scanning |
/* if copy is not 0 then copy characters to stdout while scanning |
32 |
to find start_ch. When you find it, read n characters into buf, |
to find start_ch. When you find it, read n characters into buf, |
33 |
return the number of characters read into buf, but these characters |
return the number of characters read into buf, but these characters |
34 |
MUST be free of start_ch. |
MUST be free of start_ch. |
35 |
*/ |
*/ |
36 |
char *buf; |
|
37 |
int n,start_ch,copy; |
|
38 |
{ int ch; |
{ int ch; |
39 |
int prev = 0; |
int prev = 0; |
40 |
while (1) |
while (1) |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
int |
71 |
main() |
main(void) |
72 |
{ int ch,ch1; |
{ |
73 |
char buf[20]; |
char buf[20]; |
74 |
while (3==read_some(buf,3,'\n',0)) |
while (3==read_some(buf,3,'\n',0)) |
75 |
{ buf[3] = 0; |
{ buf[3] = 0; |