3 /* get next group of tokens from stdin */
4 int get_tokens(int *dir
, char *start
, char *stop
){
8 if((c
= getchar()) != EOF
) { ++status
; }
12 if((*start
= getchar()) != EOF
) { ++status
; }
13 if(getchar() != EOF
) { ++status
; } // should be a '-'
14 if((*stop
= getchar()) != EOF
) { ++status
; }
18 if(getchar() != EOF
) { ++status
; } // should be a '-'
19 if((*stop
= getchar()) != EOF
) { ++status
; }
22 if(status
== 4 && *dir
== 1) { return 1; }
23 if(status
== 3 && *dir
== 0) { return 1; }
29 print out series of chars based on spec.
30 dir = direction to print
31 start and stop are chars in ASCII to begin and end with.
34 void print_tokens(int *dir
, char *start
, char *stop
)
36 if(*dir
== 0){ // foreward
37 while(*start
!= *stop
+ 1)
44 while(*start
!= *stop
- 1)
57 while(get_tokens(&dir
, &start
, &stop
) == 1)
59 print_tokens(&dir
, &start
, &stop
);