2 * Exercise 4-7. Write a routine ungets(s) that will push back an entire string
3 * onto the input. Should ungets know about buf and bufp, or should it just use
6 * Just use ungetch so that the data structure for buf can be changed in
13 #define MAXLEN 1000 /* max size of buffer */
23 while ((s[i++] = c = getch()) != EOF) {
35 char buf[BUFSIZE]; /* buffer for ungetch */
38 /* get a (possibly pushed back) character */
40 return (bufp > 0) ? buf[--bufp] : getchar();
43 /* push character back on input */
46 printf("ungetch: too many characters\n");
51 void ungets(char s[]) {