| 3977 | } |
| 3978 | |
| 3979 | static char *expand_token(const char *in, size_t n) |
| 3980 | { |
| 3981 | char *out; |
| 3982 | int c; |
| 3983 | char c2; |
| 3984 | const char *rest, *end; |
| 3985 | |
| 3986 | new_string(); |
| 3987 | append_string(in, n); |
| 3988 | |
| 3989 | /* get the whole line because we do not know the end of token. */ |
| 3990 | while ((c = input()) != EOF) { |
| 3991 | if (c == '\n') { |
| 3992 | unput(c); |
| 3993 | break; |
| 3994 | } |
| 3995 | c2 = c; |
| 3996 | append_string(&c2, 1); |
| 3997 | } |
| 3998 | |
| 3999 | rest = text; |
| 4000 | out = expand_one_token(&rest); |
| 4001 | |
| 4002 | /* push back unused characters to the input stream */ |
| 4003 | end = rest + strlen(rest); |
| 4004 | while (end > rest) |
| 4005 | unput(*--end); |
| 4006 | |
| 4007 | free(text); |
| 4008 | |
| 4009 | return out; |
| 4010 | } |
| 4011 | |
| 4012 | static void append_expanded_string(const char *str) |
| 4013 | { |
no test coverage detected