
#include <stdio.h>
#include <netdb.h>


main()
{
  char rptr[32];
  int board;
  int port;
  char *line;

  char buf[BUFSIZ];
  char *c, *d;
  char *index();

  struct hostent *hp;
  char host[32];

  while(fgets(buf, sizeof(buf), stdin))
    {
      if(*buf == '-')
	continue;
      
      if(strncasecmp(buf, "Name", 4) == 0)
	continue;

      if(!isspace(*buf))
	{
	  /* Name */
	  if(!(c = index(buf, ' ')))
	    continue;
	  *c++ = '\0';
	  strcpy(rptr, buf);
	  while(isspace(*c))
	    ++c;

	  /* Host */
	  if(!(d = index(c, ' ')))
	    continue;
	  while(isspace(*d))
	    ++d;
	  
	  /* Address */
	  if(!(c = index(d, ' ')))
	    continue;
	  while(isspace(*c))
	    ++c;
	  
	  /* Location */
	  if(!(d = index(c, ' ')))
	    continue;
	  while(isspace(*d))
	    ++d;

	  /* Board */
	  if(!(c = index(d, ' ')))
	    continue;
	  *c++ = '\0';
	  board = atoi(d);
	  while(isspace(*c))
	    ++c;
	}
      else
	{
	  c = buf;
	  while(isspace(*c))
	    ++c;
	}

      
      /* Port */
      if(!(d = index(c, ' ')))
	continue;
      *d++ = '\0';
      port = atoi(c);
      while(isspace(*d))
	++d;
      
      if(c = index(d, '\n'))
	*c = '\0';
      
      line = d;
      
      sprintf(host, "REP-%s", rptr);
      hp = gethostbyname(host);
      printf("%s/%d/%d|%s\n", hp ? hp->h_name : rptr, board, port, line);
    }
}
