/*
 * Network Installation Kit
 *
 * get_response: program to prompt user for a menu and return arg position
 *
 * Tom Coppeto
 * MIT Network Group
 * 17 September 1994
 *
 * Last Modified: 23 October 1995 by jyp 
 *
 * $Source: /afs/net.mit.edu/project/netconf/sun4/src/util/RCS/get_response.c,v $
 *
 */


#include <stdio.h>

main(argc, argv)
     int argc;
     char **argv;
{
  char buf[BUFSIZ];
  int i, l;

  while(1)
    {
      printf("%s", argv[1]);
      fgets(buf, sizeof(buf), stdin);
      buf[strlen(buf) - 1] = '\0';
      i = 2;
      while(argv[i])
	{
	  if(!*buf)
	    {
	      if(strcmp(argv[i], "<return>") == 0)
		exit(i-1);
	    }
	  else
	    if(strncmp(argv[i], buf, strlen(buf)) == 0)
	      exit(i-1);
	  ++i;
	}
      printf("Response \"%s\" is not correct. ", buf);
    }
}
