5 int getline(char line
[], int maxline
);
6 void copy(char to
[], char from
[]);
10 int len
; /* current line length */
11 int max
; /* maximum length seen so far */
12 char line
[MAXLINE
]; /* current input line */
13 char longest
[MAXLINE
]; /* longest line saved here */
16 while ((len
= getline(line
, MAXLINE
)) > 0)
23 printf("%s", longest
);
27 /* getline: read a line into s, return length */
28 int getline(char s
[], int lim
)
32 for (i
= 0; i
<lim
-1 && (c
= getchar()) != EOF
&& c
!='\n'; ++i
)
43 /* copy: copy 'from' into 'to'; assume to is big enough */
44 void copy(char to
[], char from
[])
48 while ((to
[i
] = from
[i
]) != '\0')