PAGES is a C++ program which counts the lines in one or more files and divides by 60 to tell me how many pages a printout will take.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
WIDTH, a C++ program which reports the length of the longest line in a given file.
WRAP2, a C++ program which wraps long lines in a text file, but which wraps some lines "early", so as to avoid breaking words.
You can go up one level to the C++ source codes.