// makeHTML.cpp
// P.Conrad, Spring 2004
// CISC181, A program to read a list of usernames from standard input,
// and produce HTML on standard output to construct a simple web page.


#include <iostream>

using std::cout;
using std::cin;
using std::flush;

void outputHTMLHeader(void); // output the <HTML> tag, header, etc. down to <BODY>
void outputHTMLTrailer(void); // close <BODY> and <HTML> tags

int main(void)
{

  const int MAX_USERNAME_LENGTH = 8; // restriction of 8 comes from Unix rules

  char username[MAX_USERNAME_LENGTH+1];  // +1 because of \0

  // output the header

  outputHTMLHeader();

  // read in a username
  
  cin >> username;

  while (!cin.eof())  // will stop at end of file, or at CTRL/D
    {

      // convert username into URL and print it out

      cout << "<A HREF=http://copland.udel.edu/~" 
	   << username << "/cisc181/files/lab00/collegeDat.txt>"
	   << username << "</A><BR>\n";
      
      // get the next username

      cin >> username;
      

    }

  // a parting thought

  outputHTMLTrailer();

  return 0;
} 


void outputHTMLHeader()
{
  cout << "<HTML>\n" 
       << "<HEAD><TITLE>CISC181 student's college.dat files</TITLE></HEAD>\n"
       << "<BODY><H1>CISC181 student's college.dat files</H1>\n"
       << "<P>\n"
       << endl;
  return;
}

void outputHTMLTrailer(void)
{
  cout << "\n"
       << "</BODY>\n" 
       << "</HTML>\n"
       << endl;
  return;
}

